[antlr-interest] LPG WAS Retaining comments

Terence Parr parrt at cs.usfca.edu
Wed Mar 12 15:30:45 PDT 2008


On Mar 12, 2008, at 2:55 PM, David Holroyd wrote:

> On Wed, Mar 12, 2008 at 02:22:55PM -0700, Gerald B. Rosenberg wrote:
>> There are times where you just need to randomly muck around in the
>> AST.  To use the AST interactively (to do user-driven refactorings in
>> my case), or where the selection conditions are context dependent, as
>> what sounds to be Stuart's case.  An AST wrapper is, I think, the
>> right approach.  The down-side is that it would be directly dependent
>> on the implementation/structure of the AST, requiring rewrite each
>> time the AST changed.
>>
>> 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... ;)

Ter


More information about the antlr-interest mailing list