[antlr-interest] deleting a left-recursive

Johannes Luber jaluber at gmx.de
Fri May 2 12:02:07 PDT 2008


jabon schrieb:
> hi all,
> 
> I have a little probleme with my grammar , I have a left recursive and I 
> have lot of diffcult to remove this.  I need a little help (I m not an 
> expert sorry and compilations lessons are far away)
> 
> expression
>    : T_LParent expression T_RParent
>    | binaryExpression
>    | castExpression
>    | desig | literal
>    | newExpression
>    | quantifierExpression
>    | unaryExpression
>    ;
> 
> 
> binaryExpression
>    : (expression (T_Ne|T_Eq|T_Ge|T_Le|T_Lt|T_Gt) expression)
>    |(expression (T_And|T_Mod|T_Star|T_Slash) expression)
>    |(expression (T_Iff|T_Implies|T_Or|T_Plus|T_Minus) expression);
> 
> thanks a lot
> 
> a+++
> 

You've reminded me that I didn't posted my tutorial about left-recursion 
removal yet. After 1 hour or so intense formatting you can see the 
result here: 
<http://www.antlr.org/wiki/display/ANTLR3/Left-Recursion+Removal>. 
Hopefully it is helpful enough. :)

Johannes


More information about the antlr-interest mailing list