Chapter 5:Semantic Analysis

Space for attributes at compiler Construction time

. Attributes can be held on a single stack. However, lot of attributes are copies of other attributes

. For a rule like A B C stack grows up to a height of five (assuming each symbol has one inherited and one synthesized attribute)

. Just before reduction by the rule A B C the stack contains I(A) I(B) S(B) I (C) S(C)

. After reduction the stack contains I(A) S(A)

Now we face the issue of allocating space for evaluation of attributes at compile time. We can use a single stack to hold all the attributes. However, as we have seen earlier, many of the attributes are simply a copy of previously generated attribute.