[antlr-interest] Indirect recursive grammar(A->B; B->C; C->A)

Randall R Schulz rschulz at sonic.net
Sun Oct 7 07:07:11 PDT 2007


On Sunday 07 October 2007 04:58, Manas wrote:
> hi.
>   I am developing a parser for OCL expressions. While generating java
> code, ANTLRWorks gave an error for indirect recursive grammar. Same
> grammar is supported by YACC. Is there any method by which this can
> be resolved. Here is the grammar I have written. Manas

YACC is an LALR parser generator. ANTLR is LL. Thus YACC tolerates left 
recursion among its productions but not right recursion while ANTLR 
tolerates right recursion and not left.

You will have to find and eliminate the left recursion that ANTLR is 
telling you is present among your grammar productions.

Randall Schulz


More information about the antlr-interest mailing list