A potential objection to the tree attribute grammar of Example 4.17 is that it repeatedly copies the

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. 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

Fantastic news! We've Found the answer you've been seeking!

Step by Step Answer:

Related Book For  book-img-for-question
Question Posted: