[antlr-interest] ambiguities in antlr3 grammar

Arun Ramakrishnan sinchronized.arun at gmail.com
Fri Nov 9 09:51:07 PST 2012


  Take this grammar snippet ( antlr 3.4 )

*********************************
lhs : (phrase | value)+;
phrase : WORD+;
value : '{}';

WORD  :   ('a'..'z')+ ;
**********************************

I get the following warning in antlrworks.
***********************************
Decision can match input such as "WORD" using multiple alternatives: 1, 2

As a result, alternative(s) 2 were disabled for that input
***********************************

I understand that rules phrase and lhs might match the same piece of
string. But, then I know I am always going to try to parse the text by
calling the specific top level rule when invoke it right. So, is there a
way to make the warnings go away.

thanks
Arun


More information about the antlr-interest mailing list