[antlr-interest] pls help
leonchiver
leonchiver at yahoo.de
Thu Dec 13 16:14:03 PST 2001
Hi,
I have following stripped down grammar:
class MyParser extends Parser;
options {
k = 2;
}
startRule :
rule
(OR rule)*;
rule :
S
(X startRule Y)*
(X Y)?;
class MyLexer extends Lexer;
X : 'x';
Y : 'y';
OR : 'o';
S : 's';
for which I'm getting the warning:
nd.g:12 warning: nondeterminism upon
nd.g:12: k==1:X
nd.g:12: k==2:S
nd.g:12: between alt 1 and exit branch of block
(line 12 is >>>> (X startRule Y)* <<<<)
I just can't figure out where the ambiguity comes from. For k = 1 it's clear
that the subrules (X startRule Y)* and (X Y)? will generate an ambiguity
but where from comes the warning for k = 2?
I would be very grateful if someone could explain me where my error
lies.
Thanks a lot,
Leon Chiver
Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/
More information about the antlr-interest
mailing list