[antlr-interest] postmortem

Gavin Lambert antlr at mirality.co.nz
Thu Mar 13 00:35:20 PDT 2008


At 09:58 13/03/2008, Andy Tripp wrote:
>Isn't there a level of understanding about ASTs, where you know 
>it's some sort of tree data structure that represents the input, 
>but you don't know all the ANTLR syntax like "^" yet (or at least 
>haven't gotten around to putting them in the grammar yet)? Isn't 
>that where the original poster was?

I do have to say: that's exactly what happened to me when I was 
first starting out with ANTLRv3.

I had a fairly trivial DSL to parse and I wanted to throw it into 
a codegen routine afterwards.  I noticed that there was this "AST" 
option that said it would output a tree, which I thought would be 
useful.  So I switched it on, and was puzzled that I didn't get a 
tree out of it.  (I was basically expecting that by default every 
time I called a subrule it would drop a level down in the 
tree.)  Eventually I gave up on that and just built my own tree 
with action code.

I think I originally just assumed that this was something that 
wasn't implemented yet, since this was circa 3.0b6 or so.  And 
there was almost no documentation at that point beyond the readme 
file :)


However I can see the other side of this too.  If ANTLR did 
default to dropping a tree level for each subrule call, how would 
you go ahout telling it to not do that?
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.antlr.org/pipermail/antlr-interest/attachments/20080313/215cdec1/attachment.html 


More information about the antlr-interest mailing list