[antlr-interest] LPG WAS Retaining comments

Gerald B. Rosenberg gbr at newtechlaw.com
Wed Mar 12 18:29:31 PDT 2008


At 04:19 PM 3/12/2008, David Holroyd wrote:
>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?
> > >
> > 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.

Antlr can do heterogeneous ASTs:

http://www.antlr.org/wiki/display/~admin/2007/07/26/Heterogeneous+AST+node+types

Regardless of whether it is LPG or Antlr, it is still just the AST or 
parse tree in all of its gory detail.  Not at all the kind of 
convenience API that I was referring to/hoping for: at the level of 
find, copy, insert, and delete.  Would be neat to automagically 
generate an AST-specific implementation from nothing more than a tree 
grammar.  Oh well. 



More information about the antlr-interest mailing list