[antlr-interest] ast rewrite rule beginner question...
Gavin Lambert
antlr at mirality.co.nz
Thu Dec 25 20:27:28 PST 2008
At 16:11 26/12/2008, Jim Idle wrote:
>Just use:
>
>expression
> : conditionalOrExpression (assignmentOperator^
> expression)?
>
> ;
Or the explicit form:
expression
: ( a=conditionalOrExpression -> $a )
( o=assignmentOperator b=expression -> ^($o $a $b) )?
;
(Note that for either of these to work, assignmentOperator must
match exactly one token.)
More information about the antlr-interest
mailing list