You are here
Home ›derivation tree
Primary tabs
derivation tree
Given a formal grammar , recall that a derivation from words to over can be visualized as a finite sequence of words over , connected by the binary relation :
| (1) |
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
1. the nodes of are labeled by elements of , or the empty word ,
2.
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
then
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 .
Remark. A derivable word may correspond to several derivation trees. See the entry ambiguous grammar for more detail.
References
- 1 H.R. Lewis, C.H. Papadimitriou, Elements of the Theory of Computation. Prentice-Hall, Englewood Cliffs, New Jersey (1981).
- 2 A. Salomaa, Formal Languages, Academic Press, New York (1973).
- 3 J.E. Hopcroft, J.D. Ullman, Formal Languages and Their Relation to Automata, Addison-Wesley, (1969).
Mathematics Subject Classification
68Q42 Grammars and rewriting systems68Q45 Formal languages and automata
- Forums
- Planetary Bugs
- HS/Secondary
- University/Tertiary
- Graduate/Advanced
- Industry/Practice
- Research Topics
- LaTeX help
- Math Comptetitions
- Math History
- Math Humor
- PlanetMath Comments
- PlanetMath System Updates and News
- PlanetMath help
- PlanetMath.ORG
- Strategic Communications Development
- The Math Pub
- Testing messages (ignore)
- Other useful stuff
Recent Activity
new correction: typo? by Filipe
May 22
new question: Linear Algebra Combination Problem! by Aleph Zero
new question: Computation of $\varphi(2000)$ by unlord
May 21
new question: pure subgroups by lvoyster
new correction: Typo in M\"obius function? by Aleph Zero
new collection: analytic number theory by Aleph Zero
May 20
new question: Taylor's Series Query! by unlord
new question: Laplace transform by J
new question: Residue Calculus by J
May 19
new Education: Project: PlanetMath Outlines Series by unlord


