[antlr-interest] Lexer non-determinism
seaswar <sje at sigma-inc.com>
sje at sigma-inc.com
Sun Dec 22 08:19:55 PST 2002
I posted this on the jGuru forum but got no reply. Perhaps I'll have
better luck here.
I don't understand why the following is ambiguous for k=2 but notfor
k=3. I checked the generated code (java, antlr 2.7.1) and it looks
right. So I turned of the warning. But I would still like to
understand why there is a warning in the first place. No warning is
generated for k=3.
class TestLexer extends Lexer;
options { k = 2; }
MULTI_LINE_COMMENT
: "/*"
( { LA(2) != '/' }? '*'
| ( "\r\n" | '\n') { newline(); }
| ~( '*' | '\r' | '\n')
)*
"*/" { $setType(Token.SKIP); }
;
ANTLR Parser Generator Version 2.7.1 1989-2000 jGuru.com
com/qsi/parser/test/test9.g:7: warning: lexical nondeterminism upon
com/qsi/parser/test/test9.g:7: k==1:'*'
com/qsi/parser/test/test9.g:7: k==2:'/'
com/qsi/parser/test/test9.g:7: between alt 1 and exit branch of block
Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/
More information about the antlr-interest
mailing list