[antlr-interest] grammar ambiguity

seaswar <suresh_easwar at acml.com> suresh_easwar at acml.com
Wed Dec 18 13:37:43 PST 2002


How do I get rid of the ambiguities in the following.:

class FooParser extends Parser;
options {k = 4;}
id3DList: id3D (COMMA id3D)*;
id2DList: id2D (COMMA id2D)*;
id3D: id2D | ID DOT ID DOT ID
id2D: ID | ID DOT ID;

class FooLexer extends Lexer;
options {k = 2;}
ID: ( 'a'..'z' )+;
COMMA:',';
DOT:'.';

the warnings I get are:
test6.g:5: warning: nondeterminism upon
test6.g:5:         k==1:ID
test6.g:5:         k==2:DOT
test6.g:5:         k==3:ID
test6.g:5:         k==4:DOT
test6.g:5:         between alts 1 and 2 of block


Thanks
Suresh


 

Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/ 



More information about the antlr-interest mailing list