[antlr-interest] error(211)
Gavin Lambert
antlr at mirality.co.nz
Mon Aug 6 02:33:35 PDT 2007
At 20:39 6/08/2007, Martin Kohl wrote:
>I've stumbled upon an error:
>error(211): Expr.g:490:3: [fatal] rule rule_name 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've had this error in a few other places and I resolved it by
>setting the backtrack=true option. However this doesn't work for
>this rule:
> ( expression ','
> | '*' ','
> | ','
> )*
> expression ':'
>
>The Line Reference of the error message points to the second
>expression. If I remove the * or the second expression the error
>is resolved.
I'm assuming that this fragment is part of the 'expression' rule,
or that the expression rule either directly or indirectly contains
whichever rule that is.
It's hard to give you anything specific without seeing more of the
grammar, but basically you need to make sure that your rules
aren't left-recursive -- ie. that there's always at least one
token to consume in each recursive "loop", and thus the loop
becomes bounded instead of infinite.
More information about the antlr-interest
mailing list