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

Terence Parr parrt at jguru.com
Thu Jul 25 16:22:43 PDT 2002

Hi Michael,

You may find this faq entry answers your question nicely :)


It's called "What is a tree parser and why would I want to use one?"

I would like to make ANTLR ASTs DOM compatible but I can't since DOM 
used the same method names as I have but return DOM not AST so Java 
bitches.  I cannot fix this w/o breaking backward compatibility big time 
with existing ANTLR translators :(  Tell those DOM guys I was here 
first ;)


On Thursday, July 25, 2002, at 11:34  AM, micheal_jor wrote:

> 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/
Co-founder, http://www.jguru.com
Creator, ANTLR Parser Generator: http://www.antlr.org


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

More information about the antlr-interest mailing list