[antlr-interest] Heterogeneous AST support?

Paul Johnson gt54-antlr at cyconix.com
Tue Jun 21 07:17:11 PDT 2005


Following on from the 'Example code with multiple AST passes' thread, my 
feeling is that I should use a single class-per-token in my AST, and 
have virtual over-ridden pass processing code in each token class (the 
homogeneous alternative being a large 2-way switch on the token type and 
current pass).

However, the comments (from Ric?) in the ASTFactory.cpp source are 
making me think twice about this (the comments at the end give the 
impression that the hetero code may not work). Does anyone have any 
experience of building and manipulating heterogeneous ASTs? Any 
potential problems/pitfalls?

Thanks -

Paul



More information about the antlr-interest mailing list