The parse tree created from the expression string consists of a hierarchy of node objects, each of which is an instance of a class derived from this class. This is because each node is a root node for the portion of the parse tree below it.
Each node in the parse tree stores its type and state information in a ptolemy.data.Token variable. A parent node uses the type and value of the ptolemy.data.Tokens contained in its child nodes to evaluate the type and value of the ptolemy.data.Token it should contain.
When a node has more than one child nodes, the lexical tokens relating the child nodes are stored in the parent node. Thus if we parsed a string such as "2+4-9", the child nodes would be leaf nodes containing ptolemy.data.Token's with values 2, 4 and 9, and the parent node would store the lexical tokens representing the "+" and the "-".
The tree is evaluated in a top down manner, calling evaluateParseTree() on the children of each node before resolving the type of the current node.
@author Neil Smyth
@version $Id: ASTPtRootNode.java,v 1.75 2005/07/08 19:57:27 cxh Exp $
@since Ptolemy II 0.2
@Pt.ProposedRating Yellow (nsmyth)
@Pt.AcceptedRating Red (cxh)
@see ptolemy.data.expr.PtParser
@see ptolemy.data.Token