Example .
. However, if different stacks are maintained for the inherited and synthesized attributes, the stacks will normally be smaller
The space used can be reduced by using different stacks for synthesized and inherited attributes. In the above example, if we use such a scheme, then less space is used by the two stacks as a whole. Now B.ps need not be pushed on to the stack for the inherited attribute of B1 and B2 since it is on the top of the synthesized attribute stack, and can be directly accessed from this stack.
This completes the discussion on attribute generation and semantic analysis. Next, we discuss type systems used by different programming languages.
|