dcsimg

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