[antlr-interest] Syntax of rewrite rule

Christian Mayer christian.mayer at bsse.ethz.ch
Thu Apr 1 04:21:59 PDT 2010


Hi,

I am wondering how to transform the rewrite rule

Expr    :   mul_expr ( ( PLUS | MINUS )^ mul_expr )*;
 
Into the explicit form with the arrow

Expr    :   a=mul_expr (  op=( PLUS | MINUS ) b=mul_expr )*   ->   ? ;

For later use in an AST tree parser.

What is the proper way to do this? I checked ² The definitive ANTL
reference²/online documentation but could not find anything about the
syntax.

Thanks and best regards,

Chris




More information about the antlr-interest mailing list