[antlr-interest] Tree rewriting

Arto Viitanen arto.viitanen at pp4.inet.fi
Wed Oct 31 09:17:41 PDT 2007


I have used an AST to generate symbol table from the source. It occurred
to me, that I could actually generate another
AST by cleaning up the code a little bit, like checking that  for
example ('+' e1=expression e2=expression) can be
rewritten as (e1), if e2 is 0. So my question really is

-   is there any reason to write another AST
-   or generate code from the current AST and try the optimization on
the same phase
-   and is there any sample on this simple optimization using ANTLR ?


--
Arto Viitanen



More information about the antlr-interest mailing list