[antlr-interest] Rewriting an N-child node to a tree
ewbank at gmail.com
Wed Jan 5 08:10:47 PST 2005
I have a grammar that produces a (very flat) tree that looks like this
- using expressions as an example:
#(EXPR ID PLUS ID MULT ID)
I want to rewrite this tree to be a standard binary expression tree:
#(EXPR #(PLUS ID #(MULT ID ID)))
However, when I try any tree rewrite stuff it (of course) trashes the
sibling node of the expression being processed and dies.
How would you do this? Is it possible/practical, or do I give up and
rewrite the parser to generate the binary expression tree directly?
- Bryan Ewbank
More information about the antlr-interest