[antlr-interest] backtrack=false and AST generation

Giampaolo Tomassoni Giampaolo at Tomassoni.biz
Sun Apr 18 09:03:47 PDT 2010


> I do not know why you get the undefined label error.
> 
> Have you considered not using a sub-rule for the then-else part?
> 
> Something like:
> 
> expression :
>     conditionalOrExpression (QMARK^ expression COMMA! expression) ?
>   ;
> 
> or if you really want ITE as the root (instead of QMARK) perhaps:
> 
> expresssion :
>     ( c=conditionalOrExpression -> $c )
>         ( QMARK t=expression COMMA f=expression-> ^(ITE $c $t $f) )?
>  ;
> 
> 
> Hope this helps...
>    -jbb

It helped a lot.
 
I was quite sure to get a non-LLR grammar that way, but now I see I have backtrack=false and still antlr doesn't complains...

Thank you, John.

Giampaolo



More information about the antlr-interest mailing list