[antlr-interest] a question about nondeterminism
xdm
xdm at suzsoft.com
Wed Dec 27 20:19:46 PST 2006
I have a question about ANTLR
(1)
I wrote a simple expression, just like this:
E:(E)
E:E (+|-|*|\) E
E: ('0'..'9')+ ('.'('0'..'9')+ )?
(2)
Adjust the expression, avoid the left recursion, and get the final
expression:
expr : ( NUM expr_tail ) | ( LPAREN expr RPAREN expr_tail ) ;
expr_tail : ( (PLUS|SUB|MUL|DIV) expr)* ;
(3)
There is a warning
warning: nondeterminism upon,
k==1:PLUS,SUB,MUL,DIV
k==2:LPAREN,NUM
between alt 1 and exit branch of block
And When I try to parse “3+1(“, there is no exception.
Can you help me?
Regards
Edison
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.antlr.org/pipermail/antlr-interest/attachments/20061228/e6e3a1c3/attachment-0001.html
More information about the antlr-interest
mailing list