Next: , Previous: , Up: Terms   [Contents][Index]


5.8 Trees

In this document, unless otherwise stated,

For brevity, in contexts where the meaning is clear, we refer to a tree node simply as a node. A node is a pair:

When looked at from the point of view of its labels, a node is often called an instance. In the following list of definitions and assertions, let

     nd = < < sym, start, end >, children >

be a tree node.

Let nd1 and nd2 be two nodes. If nd2 is a child of nd1, then nd1 is the parent of nd2.

We define ancestor recursively such that nd1 is the ancestor of a node nd2 iff one of the following are true:

Simlarly, we define descendant recursively such that nd1 is the descendant of a node nd2 iff one of the following are true:

A tree is its own root node. That implies that, in fact, tree and node are just two different terms for the same thing. We usually speak of trees when we are thinking of the nodes/trees as a collection of nodes, and we speak of nodes when we are more focused on the individual nodes.

We sometimes call a root node, a start node. We do this especially in contexts where a tree is “top-level”, that is, not the child of any other tree under discussion.

If t1 and t2 are trees, and t2 (considered as a node) is a descendant of t1, then we say t2 is a subtree of t1. By this definition, every tree is a subtree of itself.

A parse forest is a set of one or more parse trees.

We use “parse” as a noun in several senses. Depending on context a parse may be

When the meaning of “parse” is not clear in context, we will be explicit about which sense is intended.


Next: , Previous: , Up: Terms   [Contents][Index]