[antlr-interest] How to tell antlr to create a LALR(1) or LR(1) grammar

Terence Parr parrt at cs.usfca.edu
Fri Jan 27 22:21:36 PST 2006


Hi.  You need to avoid left-recursion.  See the various grammars for  
examples of doing left-associative stuff in LL.  Better yet, look at  
the tutorial Scott Stanchfield did to see how to convert.  See any  
grammar/language theory book on left-recursion elimination.

Ter

On Jan 27, 2006, at 4:55 PM, Stephen Torri wrote:

> I have a grammar that will need left and right associative rules. As I
> understand left associative rules they are recursive on the first
> element:
>
> A -> A + B |
>      B
>
> B -> 1
>
> How do I setup my grammar file to create a parser that can handle left
> recursion? Where in the manual is this for further reading?
>
> Stephen
>



More information about the antlr-interest mailing list