[antlr-interest] Unfolding of loops with antlr?

Terence Parr parrt at cs.usfca.edu
Thu Dec 27 11:27:59 PST 2007


On Dec 27, 2007, at 8:12 AM, Jon Schewe wrote:

> Given the discussion here I've taken another look at custom AST  
> walkers
> and found that it's really not that difficult to write an AST walker  
> if
> you do a good job creating the tree in the parser with rewrite  
> rules.  I
> haven't rewritten the whole grammar yet, but have written an example
> that contains most of the elements and found it very manageable.   
> Thank
> you for the suggestions to look in another direction.

Beware of simple walkers.  They are great if you want to print out  
every node or count them.  They cannot, however, answer important  
questions such as "am I in this context?". You cannot apply actions  
that are appropriate only in certain contexts very easily without  
grammatical context.

Ter


More information about the antlr-interest mailing list