[antlr-interest] Decision can match input using multiple alternatives

Finch Altar altarfinch at gmail.com
Wed Apr 21 10:14:04 PDT 2010


I am trying to implement a LOGO grammar, but the langage is a little bit
ambiguous and lacks several parenthesis usage.

Here is my expr grammar:

or : and (OR^ and)*;
and : eq (AND^ eq)*;
eq : rel ((EQ|NOTEQ)^ rel)*;
rel : add ((LT|GT|LTEQ|GTEQ)^ add)*;
add : mul ((PLUS|MINUS)^ mul)*;
mul : atom ((MULT|DIV|MOD)^ atom)*;
atom : INT | FUNCTION_ID ({needMoreArgs()}?or)*;

Everything goes well until I add function call grammar signaled by
FUNCTION_ID and the list of args

And here are my warnings:

[19:09:37] warning(200): Logo.g:215:18: Decision can match input such as
"OR" using multiple alternatives: 1, 2
As a result, alternative(s) 2 were disabled for that input
[19:09:37] warning(200): Logo.g:216:18: Decision can match input such as
"AND" using multiple alternatives: 1, 2
As a result, alternative(s) 2 were disabled for that input
[19:09:37] warning(200): Logo.g:217:26: Decision can match input such as
"EQ..NOTEQ" using multiple alternatives: 1, 2
As a result, alternative(s) 2 were disabled for that input
[19:09:37] warning(200): Logo.g:218:34: Decision can match input such as
"LT..GTEQ" using multiple alternatives: 1, 2
As a result, alternative(s) 2 were disabled for that input
[19:09:37] warning(200): Logo.g:219:29: Decision can match input such as
"PLUS..MINUS" using multiple alternatives: 1, 2
As a result, alternative(s) 2 were disabled for that input
[19:09:37] warning(200): Logo.g:220:33: Decision can match input such as
"MULT..MOD" using multiple alternatives: 1, 2
As a result, alternative(s) 2 were disabled for that input


More information about the antlr-interest mailing list