[antlr-interest] disambiguating semantic predicates

Jim Idle jimi at temporal-wave.com
Fri Sep 19 16:02:16 PDT 2008


On Fri, 2008-09-19 at 17:53 -0400, Tom Smith wrote:

> I believe part of my problem is that the grammar as shown is
> not syntatically ambiguous, as a result of some fiddling on my
> part.  However when the grammar is syntatically ambiguous,
> such as the snippet shown below, I get this error when compiling
> the grammars:
> 
> ANTLR Parser Generator  Version 3.1b2 (May 20, 2008)  1989-2008
> warning(200): grammars/SsipWalker.g:483:5: Decision can match input
> such as "EVENT DOWN Identifier NAMED_MSG DOWN Identifier ARGLIST DOWN
> POSITIONAL_ARGS DOWN '"' {PACKAGE..']', '\'..'=='} '"' UP NAMED_ARGS
> DOWN ASSIGN DOWN Identifier '"' {PACKAGE..']', '\'..'=='} '"' UP UP UP
> UP HOSTCODE DOWN HOST UP UP" using multiple alternatives: 1, 3
> As a result, alternative(s) 3 were disabled for that input
> error(201): grammars/SsipWalker.g:483:5: The following alternatives
> can never be matched: 3
> 
> event
>    :
>    ^(EVENT T1 messageExp (h=hostcode)?)
>    |
>    ^(EVENT T2 TIMEOUT (h=hostcode)?)
>    |
>    ^(EVENT T3 messageExp (h=hostcode)?)
>    ;


event: ^( EVENT
                       T1 ...
                     | T2 ...
                     | T3 ...
         );


> 
> T1 : { ... }? varName
> T2 : varName
> T3 : { ... }? varName
> 
> List: http://www.antlr.org/mailman/listinfo/antlr-interest
> Unsubscribe: http://www.antlr.org/mailman/options/antlr-interest/your-email-address
> 
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.antlr.org/pipermail/antlr-interest/attachments/20080919/cbf554d1/attachment.html 


More information about the antlr-interest mailing list