[antlr-interest] rewrite question?

Joep Suijs jsuijs at gmail.com
Sun Apr 18 02:36:24 PDT 2010


Hi guys,

The rules below
arith_expr: term ((PLUS|MINUS)^ term)* ;
PLUS        : '+'  ;
MINUS	: '-'  ;

creates a node with type PLUS or MINUS (with value '+' or '-' and puts
the terms into subnodes). There are similar rules with other
opererators and all these operators are handle the same in my
application.

How can I change this rule to a node of type 'operator' (which does
not exist yet), and keep the value and subnodes?

Thanks,
Joep


More information about the antlr-interest mailing list