[antlr-interest] AST manipulation

Kay Roepke kroepke at classdump.org
Mon Aug 20 13:04:21 PDT 2007


Hi!

On Aug 20, 2007, at 9:57 PM, James Mansion wrote:

> I have the book and its very hot on the template output - but I'd  
> like to write some passes
> over the AST that manipulate its structure in-place, changing some  
> node types, creatiing
> new nodes, and generally swizzling things around.
>
> Are there any examples of tree parsers that do this - or is that  
> the wrong approach?

That feature is forthcoming in the next ANTLR release (3.1). Ter has  
just pushed his
development branch to the main line and the target developers are now  
integrating his
changes for the different targets.

I think there's something in the wiki for that matter, but I'm not sure.

For now I think you can only build new trees or use custom actions to  
manipulate the
tree. Though that will probably cause trouble right now (as the tree  
parser will probably
be very confused by the changes).

cheers,
-k
-- 
Kay Röpke
http://classdump.org/






More information about the antlr-interest mailing list