[antlr-interest] Article against TreeWalkers
Terence Parr
parrt at cs.usfca.edu
Thu Mar 9 14:22:47 PST 2006
On Mar 9, 2006, at 2:14 PM, Jeff Barnes wrote:
> Andrew sez:
>
>> You are parsing a 1-D input and producing a tree output, right? What
>> am I missing here?
>
> Terence sez:
>
> <snip> Once you have a
> tree, you need to walk it either by hand or by grammar. By grammar,
> you can serialize a tree by adding imaginary nodes UP and DOWN that
> encode 2D aspect.
>
> Jeff sez:
>
> So, why aren't there UP and DOWN tokens in the tree metalanguage?
They are added for you so you can just give a nice tree grammar like:
expr : ^(PLUS expr expr)
| INT
;
> Or am I missing something? Methinks that would coolify a TreeWalker.
Tree grammars are cool :)
Ter
More information about the antlr-interest
mailing list