[antlr-interest] Two More Bugs in ANTLRv4
Gavin Lambert
antlr at mirality.co.nz
Mon Feb 27 12:48:44 PST 2012
At 21:46 23/02/2012, Jan Finis wrote:
>The following rule does not work:
>expr
> : 'x'
> | e1=expr '?'
> | e1=expr e2=expr
> ;
>
>Error: The following sets of rules are mutually left-recursive
>[expr]
>
>It seems to be the concatenation operation of two expressions
>(last alternative). If I leave it out, it works fine.
I don't consider that a bug either. It's basically saying that
one possible form of expr is two exprs (which in turn can each be
another two exprs). With no other distinguishing tokens there's
no way to exit that path. So that way lies infinite recursion,
madness, and/or Sparta. A compiler error is the correct response.
Was this from a real usage attempt (if so, please explain more
what you were trying), or were you just experimenting?
More information about the antlr-interest
mailing list