[antlr-interest] postmortem

Andy Tripp antlr at jazillian.com
Wed Mar 12 13:58:35 PDT 2008


Jim Idle wrote:
>
> I think you miss the point. We can't 'know' that they did or didn't 
> want a flat tree. Who is this someone that you are designating tasks 
> like this to?
>
Well, we can't "know' anything about what anyone wants, in general. The best
we can do is make a best guess. And I think the best guess is that most 
ANTLR users
want a non-flat AST.
>
>  
>
> I would think that saying only 1% of ANTLR users would already know 
> about ASTs is a bit light,
>
I wasn't saying that. I said:
            My guess is that 99% of the time, the flat AST is not what 
the person wanted.
So what are the situations where someone wants a flat AST?
>
> but  I think it would actually annoy 100% of the time.
>
How could it possibly annoy the original poster, who was confused 
because he got a flat AST,
to get message that says "warning: this tree is flat because..."
>
> If you don't know about ASTs then you don't know what it means and get 
> annoyed if you are told to go buy a book.
>
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?
>
> If you do know then you know what it means but must have wanted a flat 
> tree at that point in your development cycle.
>
No, not at all. This poster wanted a (non-flat) tree, and so do I, by 
default.
>
> I don't think that there is any problem to solve here, there are many 
> more other warnings that need to be added before worrying about this I 
> think. For a start, you have to turn on output=AST and that will 
> surely prompt most people to ask themselves if they know anything 
> about what one of these is?
>
Not really. If someone is just learning ANTLR and sets "output=AST" and 
makes a call to get a tree, they certainly might expect
it to work. By analogy, I'll try a "-verbose" option on just about any 
command-line tool if I want to see what it's
doing, without any idea of what sort of output it might produce.

I think it's very natural for someone to spend time building a 
(tree-structured) grammar,
and expecting to be able to see what kind of AST might get produced by 
default.
He might even think he won't need to do any more work, and if he at 
first got a parse tree,
he'd look at it and go "ewww, that's too much info", and then hopefully 
go figure out the
difference between a parse tree and an AST.

But giving him a flat thing, he's going to say "WTF?", not "Of course, I 
gave it zero instructions for
how to shape the tree so logically this is the tree I get".
>
>  
>
> I thought you said,, "And wouldn't the newbie be the authority on 
> whether it's confusing or not?", so why are you asking me? ;-)
>
I didn't ask you what you thought about this warning message, you 
volunteered it.
I don't even believe that it would be confusing to you...if you really 
wanted a flat AST, and you got a warning message telling
you it's a flat tree, where's the confusion? Redundant and annoying, 
maybe, but not confusing.

And you still haven't explained what the case is where anyone would want 
a flat AST.
I'm still missing that major point.
>
> It is obviously confusing if it tells you something that you don't 
> know about, but can't really tell you what to do about it. I am all 
> for improving error messages and warnings, but now I think you are 
> arguing for this because you said it and are trying to defend it. I 
> think it is an arbitrary example with no real need. It might just help 
> one person in many hundreds, I can't say that it won't, but I can't 
> really see it doing much for people. Now, improving "Can't find 
> tokenRefBang.st" is (and was) worth some effort J
>
Well, I think we agree that it would be helpful to those who don't want 
flat ASTs, right?
We just disagree on whether that's 1% of ANTLR users or 99% (or whatever).
I'm still waiting to be convinced that the number who want flat ASTs is 
not 0%.
I hope I wouldn't have to argue that most people want non-flat ASTs - 
what the heck are you
going to do with a flat AST?
>
>  
>
> Try that and see what real users do when they don't get a message 
> about having 0 ^ operators? Come on, you are just being contrary now. 
> There are plenty of other examples that users hit all the time, the 
> need to use ^ to generate a tree structure is hardly flooding the 
> group with emails from "Confused of Springfield".
>
I agree that there are probably more urgent things needing better error 
messages.
Naturally, we don't get a lot of complaints from newbies - posts to the 
mailing list are not representative
of actual users' problems.
>
>  
>
> The book isn't designed to explain why you get a flat tree or really 
> what an AST is. It does tell you how to go about building trees using 
> ANTLR. The book would have to be about 500 pages longer to cover 
> everything you need to know to start from scratch.
>
Another strawman. The only suggestion I made for the book in this thread 
is to add a paragraph about how to get the parse tree.
Even a sentence with a couple of lines of code would be sufficient. I'm 
not asking for "everything you need to know to
start from scratch".
>
>  
>
> "I learned yacc without a book, and it was painful." Whereas it took 
> me about a week because I had a decent book with some good examples 
> and had already read the dragon book -  I hope you enjoyed the beer 
> though J
>
>  
>
> "if it's just a person dig at me", no not you, Benjamin did not seem 
> to ever post without requesting another piece of information that 
> should be "right on the front page", I don't have any truck with you.
>
>  
>
> "I'm just suggesting that a small change to the tool or book can be 
> worth 1000 wiki entries." Agreed that sometimes this can be the case. 
> There are plenty of examples where the warnings need to be improved 
> (or even supplied ;-) and they are mostly known about and will 
> eventually get done I am sure. I guess I just get a bit on my high 
> horse when there are lots of clamoring for docs and articles and so 
> on, but few people actually want to put in any time doing it and when 
> they do, a lot of people don't use the search to find it anyway.
>
Hey, that's the way the world works, as opposed to the mythical 
open-source pseudo-world.
You (meaning Ter, really) can take my feedback as it's meant: 
constructive criticism, or
you can ignore it, or you can tell me to shut up. But you can't make me 
contribute where you want.
>
>  
>
> Jim
>
>  
>
> PS: Post as long as you want about anything you want if you ask me, it 
> ain't my list J
>
>  
>

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.antlr.org/pipermail/antlr-interest/attachments/20080312/4ea26890/attachment-0001.html 


More information about the antlr-interest mailing list