[antlr-interest] CommonTree & Tree grammar versus DIY
Terence Parr
parrt at cs.usfca.edu
Fri Aug 15 09:30:02 PDT 2008
On Aug 15, 2008, at 8:12 AM, Andy Tripp wrote:
> Marc,
> This "writing by hand" article is referring to walking a tree-like
> data structure (the AST).
> Pretty much every programmer already knows how to do this by hand:
>
> void walk(Tree t) {
> doSomething(t);
> for (Tree child: t.children()) {
> walk(child);
> }
> }
But empirically, people don't know how to do language stuff so that
must not be enough as you clearly know from your very complicated and
nice stuff :)
> By contrast, there are only a handful of people who know how to do
> that same thing
> with an ANTLR treewalker.
Coincidental with the people that have built language stuff ;)
> The "manipulating an AST" work of building a translator is quite a
> different
> job than the "build a lexer/parser" part of it.
Yep. i'm mostly a fan of walking not rewriting ASts by the way...that
gets WAY too hard. Further, Andy has a nice approach of rewriting.
Expect ANTLRMorph, by Leon Su, this Fall!
Ter
More information about the antlr-interest
mailing list