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

Oliver Zeigermann oliver.zeigermann at gmail.com
Fri Apr 29 23:35:16 PDT 2005


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