[antlr-interest] philosophy about translation

Loring Craymer lgcraymer at yahoo.com
Wed Oct 11 02:11:57 PDT 2006


There is a 2-3 year cycle on these discussions; you may not have been around for the last one.  Visitors have their uses; however, they lack the recognition capabilities of grammars.  They also become irrelevant for ANTLR 3--it is easier to iterate over a TreeNodeStream.

--Loring

Paul Johnson <gt54-antlr at cyconix.com> wrote: Loring Craymer wrote:
> Andy--
> 
> I deliberately chose your message to respond to because it captured the 
> pragmatic viewpoint--"I had a problem; I solved it; I did not need to 
> use trees"--quite effectively.  That is quite a bit different from the 
> more usual "I tried to use ANTLR's tree facilities and discovered that 
> writing them by hand and using a visitor is easy and clearly is the ONE 
> TRUE SOLUTION to language processing" that appears in the group every so 
> often.  

Perhaps I'm being thick here, or I haven't been paying attention, but I 
haven't noticed anyone making this argument (and certainly not myself).

I use ANTLR's tree facilities all the time. What I don't do is to use 
tree *grammars*, and it is the argument against grammars that I have 
occasionally seen in this list. This specific AST/tree argument, as I 
understand it (and *not* the translation philosophy argument) is about 
whether the advantages of having a tree grammar outweigh the disadvantages.

The ease of using visitors is not central to that argument. The problem 
is that tree grammars are (currently?) inflexible, but visitors are both 
flexible and trivial, so you should use visitors where appropriate.

Paul


 		
---------------------------------
Do you Yahoo!?
 Everyone is raving about the  all-new Yahoo! Mail.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.antlr.org/pipermail/antlr-interest/attachments/20061011/e21eddaf/attachment.html 


More information about the antlr-interest mailing list