[antlr-interest] Generating tree walkers.

Monty Zukowski monty at codetransform.com
Tue Jun 22 11:55:57 PDT 2004


On Jun 22, 2004, at 9:14 AM, Bharath Sundararaman wrote:

> I have the lexer, parser and an AST for a PASCAL-like grammar and I 
> would
> like to perform semantic analysis/symbol table checks/constant folding 
> etc.
> Is it a cumbersome task to write a tree walker for the abstract syntax 
> tree
> to perform these checks? When you perform semantic analysis on your 
> input,
> would you prefer to walk the tree or would you just embed it in your 
> grammar
> as actions?

I prefer to build the symbol table during the parse (necessary to parse 
C).  Analysis I like to do in tree passes, it's cleaner because it's a 
simplification of the grammar which you build so that it doesn't have 
ambiguities or extraneous punctuation, etc.

Monty

ANTLR & Java Consultant -- http://www.codetransform.com
ANSI C/GCC transformation toolkit -- 
http://www.codetransform.com/gcc.html
Embrace the Decay -- http://www.codetransform.com/EmbraceDecay.html



 
Yahoo! Groups Links

<*> To visit your group on the web, go to:
     http://groups.yahoo.com/group/antlr-interest/

<*> To unsubscribe from this group, send an email to:
     antlr-interest-unsubscribe at yahoogroups.com

<*> Your use of Yahoo! Groups is subject to:
     http://docs.yahoo.com/info/terms/
 



More information about the antlr-interest mailing list