[antlr-interest] parse trees and syntax of parse trees

ronald.petty at milliman.com ronald.petty at milliman.com
Thu Apr 22 10:03:18 PDT 2004


"linked list of all the tokens" .. "start building a tree..." seems to 
actually clear alot up.  I will look into the class notes.

I will stop asking about this till I read the notes. :)

Thanks Monty & John.
Ron



Monty Zukowski <monty at codetransform.com> 
04/22/2004 11:57 AM
Please respond to
antlr-interest at yahoogroups.com


To
antlr-interest at yahoogroups.com
cc
Monty Zukowski <monty at codetransform.com>
Subject
Re: [antlr-interest] parse trees and syntax of parse trees 






On Apr 22, 2004, at 8:25 AM, ronald.petty at milliman.com wrote:

>
> So when using the parser without any tree syntax that would still 
> produce a AST correct?  If so, why have the manual intervention of the 
> Tree syntax?  I believe I am confused on the seperation of the parser 
> and trees.
>

No, a parser doesn't have to create a tree.  Turn off tree building and 
the parser merely parses and executes whatever action code you have. 
Turn it on and you get a "tree" which has no structure--it will be a 
linked list of all the tokens as nodes but there will never be a child 
node, they will all be siblings.

You start getting a tree structure once you start building a tree by 
adding the ^ operator to make root nodes with children.  There are, in 
fact, many different ways to structure your trees.  I'm going through 
the process right now myself with an SQL grammar.  I've been taking 
notes and when I understand what I've been doing I'll post and open up 
for discussion, after which I hope to write an article about it.

Terence has an excellent tutorial on tree building on his USF lecture 
notes site, linked to from antlr.org.  That should help clarify some 
typical uses for trees.

Monty Zukowski

ANTLR & Java Consultant -- http://www.codetransform.com
ANSI C/GCC transformation toolkit -- 
http://www.codetransform.com/gcc.html
Embrace the Decay -- http://www.codetransform.com/EmbraceDecay.html



 
Yahoo! Groups Links



 




**************************************************************************************
This communication is intended solely for the addressee and is
confidential. If you are not the intended recipient, any disclosure, 
copying, distribution or any action taken or omitted to be taken in
reliance on it, is prohibited and may be unlawful. Unless indicated
to the contrary: it does not constitute professional advice or 
opinions upon which reliance may be made by the addressee or any
other party, and it should be considered to be a work in progress.
**************************************************************************************
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.antlr.org/pipermail/antlr-interest/attachments/20040422/b1145105/attachment.html


More information about the antlr-interest mailing list