[antlr-interest] [newbie] nondeterminism upon error
Martin Probst
mail at martin-probst.com
Sun Nov 26 08:36:45 PST 2006
Hi,
> Can anyone give me some hints? I don't get why that rule is
> nondeterministic... If anyone wants to see the whole file I can put
> it online somewhere.
Can varid be followed by another varid or idrest?
If you have:
varid: SMALL (idrest)*;
idrest: (SMALL | LARGE | ... )*
Then the parser will first consume a SMALL token, then for example
take another SMALL token, then the parser will be within the idrest
rule. If now another SMALL token comes up, the parser cannot decide
whether it should parse the new token as part of the idrest rule
('alternative 1') or exit the idrest rule and parse it as another
iteration of the (idrest)* block ('exit branch').
Does this help?
Regards,
Martin
More information about the antlr-interest
mailing list