[antlr-interest] What is the real value of ANTLR TreeParsing?

micheal_jor open.zone at virgin.net
Thu Jul 25 11:34:26 PDT 2002


Hi All,

Can anyone please define what the real value of TreeParsers are?

I am more familiar with the construction of a custom AST object 
hierarchy that supports the use of ConcreteVisitors (cf The Visitor 
Pattern) to implement phases such as type-checking, code-generateion 
etc.

Given that TreeParsers essentially mandate the use of ANTLR's own AST 
structure, I feel the need to be very clear about their utility. So 
far all I can see is:

a. Since ANTLR AST is used, AST creation is easier and absorbed into 
grammar creation costs 
b. Supplied utilities (ParseView and ASTFrame) allows visualization 
of AST.
c. For [relatively straightforward] source-to-source translation 
tasks, TreeParsers are probably the best choice given the reduction 
in code required and the "executable documentation" aspect of the *.g 
specifications.

Since choosing to use TreeParsers also effectively precludes using 
custom ASTs and the Visitor pattern....are there any limitations to 
adopting ANTLR ASTs and TreeParsers?. The project of interest is a 
code transformer/analyzer for about three custom languages. It is 
written in Java currently (without ANTLR) but a switch to C++ is 
likely if I can find decent C++ ANTLR examples to build off.

Cheers,

Micheal



 

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



More information about the antlr-interest mailing list