Question: A potential objection to the tree attribute grammar of Example 4.17 is that it repeatedly copies the entire symbol table from one node to another.
A potential objection to the tree attribute grammar of Example 4.17 is that it repeatedly copies the entire symbol table from one node to another. In this particular tiny language, it is easy to see that the referencing environment never shrinks: the symbol table changes only with the addition of new identifiers. Exploiting this observation, show how to modify the pseudocode of Figure 4.14 so that it copies only pointers, rather than the entire symbol table.
Figure 4.14

Attributes Class of node Variants Inherited Synthesized location, errors program item int decl, real_decl, read, write, :=, null int.const, real_const, id, +, -, x, , symtab, errors.in location, errors_out xpr symtab location, type, errors, name (id only) float, trunc
Step by Step Solution
3.71 Rating (159 Votes )
There are 3 Steps involved in it
The key idea is to represent the symbol table as a stack x specifically a linked list ... View full answer
Get step-by-step solutions from verified subject matter experts
