[antlr-interest] [fatal] rule Tokens has non-LL(*) decision due to recursive rule invocations
Gavin Lambert
antlr at mirality.co.nz
Thu Nov 6 12:25:19 PST 2008
At 07:50 7/11/2008, Giovane wrote:
>"Test.g:1:8: [fatal] rule Tokens has non-LL(*) decision due to
>recursive rule invocations reachable from alts 1,4. Resolve by
>left-factoring or using syntactic predicates or using
>backtrack=true option."
>I tried several alternatives in this grammar but I couldn't solve
>the problem. I have no idea what the rule "Tokens" means, because
>I don't have this rule in my grammar.
The "Tokens" rule is the auto-generated parent rule of all your
top-level lexer rules. So this means that there is ambiguity
between these rules.
The most obvious problem I can see is the PATHTERM rule. Since it
refers to other non-fragment lexer rules (especially on the left
side), that's instant ambiguity right there.
I think the biggest problem though is that many of the lexer rules
you have there (eg. the expressions and operators) look like they
ought to be parser rules instead. Certainly, if you want to keep
them as lexer rules then you'll need to modify them for
whitespace.
I'm not sure why you're getting that specific error, but it's
probably not helped by your grammar being completely saturated
with ambiguity (StepExpr is also internally ambiguous).
More information about the antlr-interest
mailing list