where and . Each is a derivation step, which means that there is a production in which, when applied to , yields . In other words, there is in such that and , where are words over .
When the formal grammar is context-free, a derivation can be represented by an ordered tree, revealing the structure behind the derivation that is usually not apparent in the linear representation above. This ordered tree is variously known as a derivation tree or a parse tree, depending how it is being used.
In the foregoing discussion, is context-free, and any derivation of begins with , the starting non-terminal.
Definition. A parse tree of is an ordered tree such that
A parse tree such that the root has label is called a derivation tree, or a generation tree. Every subtree of a derivation tree is a parse tree.
Remark. Since is context-free, in a parse tree, any node that is not a leaf is labeled by a non-terminal symbol.
For example, if , , and the productions of are
represents a derivation tree of . The tree represents the following derivations
Definition. If are the leaves of a parse tree , with , then the result of is the word , where is the label of . A word over is said to correspond to a parse tree if it is the result of the tree.
In the example above, the result of the tree is .
|Date of creation||2013-03-22 19:00:17|
|Last modified on||2013-03-22 19:00:17|
|Last modified by||CWoo (3771)|
|Defines||result of a derivation tree|