[antlr-interest] LPG WAS Retaining comments

David Holroyd dave at badgers-in-foil.co.uk
Wed Mar 12 16:19:24 PDT 2008


On Wed, Mar 12, 2008 at 03:30:45PM -0700, Terence Parr wrote:
> On Mar 12, 2008, at 2:55 PM, David Holroyd wrote:
> >>So, how to generate the implementation of a reasonably generic AST
> >>random access/manipulation API?
> >
> >I believe LPG (ANTLR competitor!) has some capability in this area,
> >
> > http://kent.dl.sourceforge.net/sourceforge/lpg/LPG_Automatic_AST_Generation.htm
> >
> >Not that this on its own says much about problems like code  
> >refactoring,
> >but getting a heterogeneous AST for 'free' sounds nice.
> 
> Unfortunately, that is a parse tree not an AST... ;)

Well from the little I've seen, it's tree construction capabilities are
very limited compared to ANTLR's, but as someone who's written a fairly
large heterogeneous *AST* by hand[1] I see a fair bit of redundancy
between the hand crafted code, and the information already available in
the grammar.

Pesky redundancy!

(So how easy is it to create new output=XXX options for ANTLR?)


ta,
dave

[1] http://svn.badgers-in-foil.co.uk/metaas/trunk/src/main/java/uk/co/badgersinfoil/metaas/dom/

-- 
http://david.holroyd.me.uk/


More information about the antlr-interest mailing list