[antlr-interest] disambiguating semantic predicates

Tom Smith yotommy at gmail.com
Fri Sep 19 14:53:18 PDT 2008


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)?)
   ;

T1 : { ... }? varName
T2 : varName
T3 : { ... }? varName


More information about the antlr-interest mailing list