[antlr-interest] Article against TreeWalkers
Andrew Bell
andrew.bell.ia at gmail.com
Thu Mar 9 12:36:47 PST 2006
On 3/9/06, mental at rydia.net <mental at rydia.net> wrote:
> Quoting Andrew Bell <andrew.bell.ia at gmail.com>:
>
> For example:
>
> a : A B C ;
>
> could (notionally) be written:
>
> a : A NEXT B NEXT C NEXT ;
>
> NEXT simply indicates the normal behavior of advancing to the next
> token.
>
> However, when your tokens happen to be nodes in a tree, there are
> additional navigation possibilities. You could still use NEXT to
> advance to the next sibling token (i.e. node), but you also have:
>
> * UP - moves to the parent of the current node
>
> * DOWN - moves to the first child of the current node
>
> This is a bit like the way that zippers unravel a tree into a
> sequence of navigation operations, though through a different axis.
I guess I wasn't clear. Aren't we still talking about parsing a text
stream? Or are we parsing something else -- some data structure that
is in the form of a tree.
--
Andrew Bell
andrew.bell.ia at gmail.com
More information about the antlr-interest
mailing list