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

Loring Craymer Loring.G.Craymer at jpl.nasa.gov
Fri Apr 29 22:44:19 PDT 2005


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