[antlr-interest] Tree rewriting -- adding subtrees

The Researcher researcher0x00 at gmail.com
Wed Apr 13 07:49:37 PDT 2011


Stephen,

For what its worth, I too am spending a considerable amount of time
rewriting trees, and any time I get to something not in "The Definitive
ANTLR Reference", I immediately jump to using code.

At first it was a royal pain because I tried to write the code from scratch.
I then turned to writing each part of the tree in ANTLR, generating the
compiled code, and then cutting and pasting the compiled code back into what
I needed and stitching together. The rewrite comments are a big help here.

This also involved creating imaginary nodes, but be careful not to do what I
just did and create a token of one type and add text of a different type.

This is one area where I have considered converting the trees to PROLOG and
solving or using http://strategoxt.org/

Eric


More information about the antlr-interest mailing list