Example .
. Construction of a parse tree is done by starting the root labeled by a start symbol
. repeat following two steps
- at a node labeled with non terminal A select one of the productions of A and construct children nodes
- find the next node at which subtree is Constructed
To construct a parse tree for a string, we initially create a tree consisting of a single node (root node) labeled by the start symbol. Thereafter, we repeat the following steps to construct the of parse tree by starting at the root labeled by start symbol:
. At node labeled with non terminal A select one of the production of A and construct the children nodes.
. Find the next node at which subtree is constructed.
|