Dependency Graph for Parse Tree
In this class, We discuss the Dependency Graph for Parse Tree.
For Complete YouTube Video: Click Here
The reader should have prior knowledge of annotated parse tree. Click Here.
The below diagram shows the syntax-directed definition for expression evaluation and annotated parse tree.
The dependency graph shows the order of evaluation of semantic rules.
We are using top-down parsing techniques.
The top-down approach follows the leftmost derivation.
Dependency graph:
The below diagram shows the dependency graph for the expression 3 * 5.
First, the production F – id is completed. so id.lexvalue is assigned to F.val.
We show the assignment of lexvalue to F.val using a directed edge.
Important:
After completion of F.val the production T – *FT’ will expand.
Point to understand: during the expansion of T – * FT’, we had the semantic condition T’.inh = F.val.
Before expanding the production F.val should be assigned.
Similarly, In the next expansion T’ – epsilon. The semantic condition T’.inh should get value from F.val and parent attribute T’.inh.