[antlr-interest] Philosophical: How to collect data in AST traversal

Loring Craymer Loring.G.Craymer at jpl.nasa.gov
Sat Apr 30 01:06:23 PDT 2005


Oliver--

I should probably point out that 2.8 makes tree transformation and
transformation design easy.

Cheers!

--Loring

> -----Original Message-----
> From: Oliver Zeigermann [mailto:oliver.zeigermann at gmail.com]
> Sent: Friday, April 29, 2005 11:35 PM
> To: Loring Craymer
> Cc: antlr-interest at antlr.org
> Subject: Re: [antlr-interest] Philosophical: How to collect data in AST
> traversal
> 
> Thanks, good idea, really! However, I really do something
> quick'n'dirty using an existing Java tree grammar. That's why I wanted
> the impact on it to be as small as possible.
> 
> Oliver
> 
> On 4/30/05, Loring Craymer <Loring.G.Craymer at jpl.nasa.gov> wrote:
> > Oliver--
> >
> > If a tree structure requires moving a lot of data around, that is an
> > indicator that you have the "wrong" tree.  Unless you are doing
> something
> > quick and dirty, it will probably pay off to transform the tree into a
> form
> > that is easy to process and captures the appropriate semantics.  The end
> > result will be more maintainable and can be reused for related problems.
> >
> > Cheers!
> >
> > --Loring
> >
> > > -----Original Message-----
> > > From: antlr-interest-bounces at antlr.org [mailto:antlr-interest-
> > > bounces at antlr.org] On Behalf Of Oliver Zeigermann
> > > Sent: Friday, April 29, 2005 12:56 AM
> > > To: antlr-interest at antlr.org
> > > Subject: [antlr-interest] Philosophical: How to collect data in AST
> > > traversal
> > >
> > > Folks!
> > >
> > > I was just working with the Java grammar and had to add some action
> > > data into the tree parser. I ended up passing data around between
> > > several rules which caused quite some changes and also warnings
> > > because of unsued return types. So I was wondering why not just
> > > modifying class memebers from all rules that contain wanted data. I
> > > know this may end up in the "global variables are evil" argument, but
> > > I was just wondering how others are dealing with this.
> > >
> > > Thanks for any comments
> > >
> > >   Oliver
> >
> >



More information about the antlr-interest mailing list