[antlr-interest] Article against TreeWalkers

Andrew Bell andrew.bell.ia at gmail.com
Thu Mar 9 11:28:33 PST 2006


On 3/8/06, Terence Parr <parrt at cs.usfca.edu> wrote:
> On Mar 8, 2006, at 8:54 AM, Jeff Barnes wrote:
> > Andy sez:
> > I realized that tree parsing is identical to text parsing, albeit
> > in two dimensions instead of one.
>
> I've been trying to scream that as loud as I can...not loud enough I
> guess. ;)  All v3 recognizers derive from same base class, so even in
> practice recog. is all the same thing: 1D or 2D :)
>
> > Jeff sez:
> >
> > LOL! I never got that either. To me, a tree seems multi-
> > dimensional; a table is two-dimensional. Terrence??
>
> 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_.  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. 
You are parsing a 1-D input and producing a tree output, right?  What
am I missing here?

--
Andrew Bell
andrew.bell.ia at gmail.com


More information about the antlr-interest mailing list