[antlr-interest] Article against TreeWalkers
Terence Parr
parrt at cs.usfca.edu
Thu Mar 9 11:40:00 PST 2006
On Mar 9, 2006, at 11:28 AM, Andrew Bell wrote:
>> a : ^(A B) ;
>>
>> is same as
>>
>> a : A DOWN B UP ;
>>
>> if you insert those imaginary navigation nodes, it is just a simple
>> 1D grammar. :) v3 does this. Rather a nice generalization, right?
>
> But aren't you parsing input _text_.
Hi.
nope
> Isn't what this is all about?
> What do DOWN and UP do here? Is there a token in the input called UP
> or DOWN? You aren't really parsing a tree, you are building a tree.
we're talking about walking a tree here...
> You are parsing a 1-D input and producing a tree output, right? What
> am I missing here?
This is the tree parser not parser creating trees. 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. Then you parse normally as a 1D stream of nodes.
Char, token, tree node...same thing. a stream of int types to parse :)
Ter
More information about the antlr-interest
mailing list