[antlr-interest] resolving left-recursive rules

Terence Parr parrt at cs.usfca.edu
Thu May 18 10:54:38 PDT 2006


On May 18, 2006, at 6:53 AM, Dieter Frej wrote:

> Hi everybody,
>
> at the weekend I had to much time and started copying the Java grammar
> from the Java language specification to antlr v3

Hooray!

> . Unfortunately, this
> grammar contains a lot of left-recursive rules and antlr does not like
> left-recursiveness.
>
> An example is
> EnumConstants:
> EnumConstant
> EnumConstants , EnumConstant
>
> My question is now what is the best ways to solve such left-recursive
> rules? antlrworks provides some automatic resolving, but I have no  
> idea
> if it is doing it the right why. Or with other words: I would like to
> understand what it is doing ;-)

Let ANTLRWorks do its thing and then check a textbook or web search :)

Ter



More information about the antlr-interest mailing list