[antlr-interest] How does one use the result of parser besidessemantic actions?

james_cataldo at agilent.com james_cataldo at agilent.com
Tue Jul 25 09:30:16 PDT 2006


There's two solutions.  One is to build a sequence of antlr tree parsers (which are basically just tree walkers) and use semantic actions to do things like scope checking, type checking, tree pruning/transforming, and code generation.  Of course, everything gets compiled to Java code, and there is a fairly rich API for doing things manually.  This is the second option.

I prefer the first option, because you avoid writing custom methods for depth first search, but there's a little extra effort required up front to think about semantic actions using tree parsers.  You will likely write some Java classes this way to serve as helpers for your tree walkers.  I agree that I haven't seen a great end-to-end example.  I've been developing such an example, but it's propriatary, so unfotunately I can't share it.

Cheers,
Adam Cataldo

________________________________

From: antlr-interest-bounces at antlr.org [mailto:antlr-interest-bounces at antlr.org] On Behalf Of Jiho Han
Sent: Tuesday, July 25, 2006 9:03 AM
To: antlr-interest at antlr.org
Subject: [antlr-interest] How does one use the result of parser besidessemantic actions?



Almost all of the examples and tutorials I've seen uses semantic actions to "use" the parser result. 
And most of these are very trivial (take calc for example). 
How do I go about using the parser without using semantic actions?  Are there events or is there a set of apis for walking the result, etc.?

Thanks 

Jiho Han
Senior Software Engineer
Infinity Info Systems
The Sales Technology Experts
Tel: 212.563.4400 x216
Fax: 212.760.0540
jhan at infinityinfo.com <mailto:jhan at infinityinfo.com> 
www.infinityinfo.com <http://www.infinityinfo.com/>  




More information about the antlr-interest mailing list