[antlr-interest] ANTLR 3 output=AST for tree parser?

FranklinChen at cmu.edu FranklinChen at cmu.edu
Mon Feb 26 12:42:43 PST 2007


Kay Roepke writes:
> 
> On Feb 26, 2007, at 3:14 PM, Mark Bednarczyk wrote:
> 
> > So in essence, I rely on tree walker rules to do the matching and  
> > get me in
> > the right place of the AST, the action code to do any processing and
> > rewrites and then rewrite "->" to produce the templates in the last  
> > phase of
> > the processing.
> 
> Yeah, that's the way to do it right now. In the future it'd be  
> awesome to do tree
> transformations by having some syntax for it :)
> 
> cheers,
> -k

Yes, that's what I've been having to do also, performing rewrites by
hand.  The reason I really like having ANTLR 2 style tree
transformations is that for various purposes (debugging and
retargeting), it is useful for me to be able to have intermediate
trees.  In ANTLR 3, I am having to do do a lot inside actions, and
also this means that the whole parser has to be recompiled again and
again even though after the parsing itself is done (to the simplest
possible AST without rewrites), all I'm actually changing is the tree
structure I'm outputting.

-- 
Franklin


More information about the antlr-interest mailing list