[antlr-interest] postmortem
Andy Tripp
antlr at jazillian.com
Wed Mar 12 09:50:11 PDT 2008
And so another ANTLR thread winds down.
Here's my cynical summary:
* Any ANTLR newbie who has just figured out how to get an ANTLR-produced AST
will continue see something that doesn't look like a tree, and he'll
have a "WTF?" moment.
Why? Because we wouldn't want to show him a parse tree, as a parse
tree is really not
the same as as AST - just say that to him and I'm sure he'll understand.
* The more experienced guy who wants to know how to get a parse tree,
found 30 references
to "parse tree" in the book, none of which told him how to produce a
parse tree. No
suggestion that the book could be improved, because it's right there
in the wiki FAQ - duh!
* The other guy who chimes in to explain how easy it is to get a parse
tree actually is
explaining how to get an AST, and no one even corrects him, let alone
suggests that
some documentation might be improved to avoid this confusion. There's
no problem here,
because the right answer is out there somewhere.
* The experts continue to see these issues in terms of grammars and
trees and syntax and
technically correct software. There is no one in sight who will look
at the problem
from the point of view of the guy who just called "showTree()" and
got back something
that doesn't look like a tree. No one will ask him "what did you
expect to see?" or
"what would you like to see?" None of that matters because,
technically, he has
explicitly asked for a "flat tree" (which really is a tree) by
putting zero "^" characters
in his grammar.
* The original poster, having invested a few minutes to vent the
frustrations of himself
and certainly at least a few others who didn't bother, goes on his
merry way. No
ANTLR documentation has changed. No warning message from ANTLR saying
"you don't have any ^ characters in your grammar, so you'll get a
flat AST, see the
section on building ASTs in the book". Just another newbie who didn't
know how
to enhance his grammar to build a decent AST. It's his own fault and
his own problem,
because building parsers is hard, and he just wasn't up to it.
</sarcasm>
Andy
More information about the antlr-interest
mailing list