[antlr-interest] CommonTree & Tree grammar versus DIY

Andy Tripp antlr at jazillian.com
Thu Aug 14 15:09:19 PDT 2008


Do it yourself: http://www.jazillian.com/articles/treewalkers.html
If you try to use treewalkers to do multiple passes over the AST,
you'll spend more time fighting with the grammar than getting stuff done.

Andy

Carter Cheng wrote:
> I have been working on a compiler system for a dialect of an existing language and so far I have been using the ^() syntax to generate the "AST" using ANTLR's tree construction routines. 
> 
> The difficulty I have been facing is how best to manipulate these trees during subsequent passed through them especially if multiple passes are needed to check for various properties, construct the symbol table and for type checking. Would this entail using multiple tree grammar files one for each pass?
> 
> It seems that it might be easier at present to DIY the AST construction using a tailored representation to the grammar in question as would be done if I was using something like YACC. 
> 
> Is this really the case or are there compelling reasons for using the ^() syntax? 
> 
> Thanks in advance,
> 
> Carter.
> 
> 
>       
> 



More information about the antlr-interest mailing list