[antlr-interest] philosophy about translation

Paul Johnson gt54-antlr at cyconix.com
Wed Oct 11 01:35:37 PDT 2006


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


More information about the antlr-interest mailing list