What's an elegant way to check whether a node is a PLUS node and then to lift its children to the parent PLUS node?

Terence Parr

I would suggest calling a rule that translates the tree into a flat list with no root.

options {buildAST=true;}
...
plus : #(PLUS flattenPlus .) ; // flatten second arg

flattenPlus : #(PLUS! (.)*) ;  // something like that
0 Comments  (click to add your comment)
Comment and Contribute

 

 

 

 

 


(Maximum characters: 1200). You have 1200 characters left.

 

 

About | Sitemap | Contact