[antlr-interest] Re: another way to preserve token order in ASTs

Terence Parr parrt at cs.usfca.edu
Sun Aug 1 13:02:27 PDT 2004


On Jul 31, 2004, at 6:42 PM, thrutchy wrote:

> Yep, already read that.  I like the method I have below because:

Ooops...Sorry.

> - changes were minimal (override one method in an AST)
> - AST nodes need no additional data (but I need one extra node per
> root - you could argue which is best)
> - I knew how to also preserve whitespace
> - it made more sense to me

Those are good reasons.  I had trouble dealing with tokens not put into 
the tree.  How can I spit them back out!?

> I think the way I really would like to have done this would be to have
> a "left" children pointer in addition to current children pointer and
> sibling pointer.  With AST nodes like that, these rules:

Yeah, double link would be nice.

Ter
--
CS Professor & Grad Director, University of San Francisco
Creator, ANTLR Parser Generator, http://www.antlr.org
Cofounder, http://www.jguru.com
Cofounder, http://www.knowspam.net enjoy email again!
Cofounder, http://www.peerscope.com pure link sharing





 
Yahoo! Groups Links

<*> To visit your group on the web, go to:
    http://groups.yahoo.com/group/antlr-interest/

<*> To unsubscribe from this group, send an email to:
    antlr-interest-unsubscribe at yahoogroups.com

<*> Your use of Yahoo! Groups is subject to:
    http://docs.yahoo.com/info/terms/
 



More information about the antlr-interest mailing list