[antlr-interest] how to modify an AST after it has been constructed

Andy Tripp antlr at jazillian.com
Wed Aug 6 13:40:35 PDT 2008


Gerard van de Glind wrote:

> Is it possible to modify an AST after it has been constructed?
> 
> And what is the best way to do it?

The AST is just a data structure, so you can easily modify it in your
code. For example, if you're using C, here's the documentation for
BaseTree:  http://www.antlr.org/api/C/struct_a_n_t_l_r3___b_a_s_e___t_r_e_e__struct.html
For Java, it's here: http://www.antlr.org/api/Java/classorg_1_1antlr_1_1runtime_1_1tree_1_1_base_tree.html
Start out here: http://www.antlr.org/api/index.html

If you're using Java, the Javadoc for ANTLR3 runtime is still missing here: 
http://www.antlr.org/wiki/display/ANTLR3/Java+runtime
...but you can generate it yourself by going to the
runtime/Java/src directory and running:
 
   javadoc -d api org.antlr org.antlr.runtime org.antlr.runtime.debug org.antlr.runtime.misc org.antlr.runtime.tree

Andy


More information about the antlr-interest mailing list