[antlr-interest] postmortem

Jim Idle jimi at temporal-wave.com
Thu Mar 13 07:02:31 PDT 2008


OK - then I give in ;-), perhaps it is a reasonable thing to warn about a flat tree, but giving out the parse tree still doesn't make a lot of sense :-0

 

Jim

 

From: Gavin Lambert [mailto:antlr at mirality.co.nz] 
Sent: Thursday, March 13, 2008 12:35 AM
To: Andy Tripp; Jim Idle
Cc: antlr-interest
Subject: Re: [antlr-interest] postmortem

 

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/f9d5654d/attachment-0001.html 


More information about the antlr-interest mailing list