[antlr-interest] Why is this nondeterministic?

danfuzz danfuzz at milk.com
Sun May 26 15:53:37 PDT 2002


The following is a very simplified version of a grammar I'm working
on (attached below). When I try to compile it, I get the following
warning:

warning: lexical nondeterminism between rules REGULAR and SPECIAL upon
/home/danfuzz/cvs/local/stuplate/com/milk/stuplate/abc.g:0: k==1:'a'
/home/danfuzz/cvs/local/stuplate/com/milk/stuplate/abc.g:0: k==2:'b'

I don't understand why it's nondeterministic, and so I'm not sure how
to change it. Help would be appreciated. Thanks!

-dan

##########

class AbcLexer extends Lexer;

options 
{
    k = 2;
    charVocabulary = 'a'..'c';
}

REGULAR:
    (REGULAR_BIT)+;

SPECIAL:
    'a' 'b'
;

protected
REGULAR_BIT:
    ('b' | 'c')
|   ('a' 'a')
|   ('a' 'c')
;


 

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



More information about the antlr-interest mailing list