[antlr-interest] Is there a way to decompose subrule's trees while building a tree?
Josh Scholar
joshscholar at nightstudies.net
Wed Aug 8 23:15:27 PDT 2007
It would be helpful to be able to CAR and CDR your way through subrule
AST trees inside of rewrite rules, or for other things like making an
imaginary token that has the line and column information of a token
from a subrule (or replacing a token from a subrule match).
For instance inside of this rule:
arg1 : (argScope -> argScope)
( biop=('.'|'->') argScope -> ^($biop $arg1 argScope)
*** LOOK HERE ****
| b ( l=list -> ^(AT[cdr($l)] $arg1 car($l))
| app='(' (expr (',' expr)*)? ')' )
->^(APPLY[$app] $arg1 expr+)
| post=('++'|'--') ->^(POSTOP[$post] $post $arg1)
)*
;
Josh Scholar
More information about the antlr-interest
mailing list