Finished tree grammar AST construction

Well, I was wrong. Building ASTs from tree grammars was not as easy as I thought. There were a lot of little changes everywhere and Kay Roepke and I had to examine all of the interfaces to figure out where each method best fit. Previous entry Rewrite Tree Node Stream Design was way too simple. There are lots complications, but I have it working nicely. I added a whole bunch of unit tests. The rewrites even work with the new heterogeneous tree node stuff. I make copious notes in the README.txt file, but I'm not sure if the other target developers can see into my dev branch. Anyway, we'll have to say this for a 3.1 release.

The basic idea is that, given no instructions to the contrary, ANTLR tree grammars will build a copy of the input tree; nodes for node. Just turn on output=AST:

grammar TP;
options {output=AST;}
a : ID ;

Now, that is pretty inefficient if all you want to do is tweak a small subtree within a very large tree. Use the rewrite mode and then rewrite rules alter the tree matched for that alternative. No implicit tree construction is done. Only rewrite rules alter the tree. Rewrites do, however, set the return tree for that rule.

grammar TP;
options {output=AST;}
file : ... ;
...
/** Alter the ASSIGN node to be SET */
assign : ^(ASSIGN ID INT) -> ^(SET ID INT) ;