Bottom-up evaluation of S-attributed definitions
.Can be evaluated while parsing
. Whenever reduction is made, value of new synthesized attribute is computed from the attributes on the stack
. Extend stack to hold the values also
. The current top of stack is indicated by ptr top
Synthesized attributes are evaluated using the attributes of the children nodes only. So in a bottom up evaluation, if the attributes are maintained on a stack then the attributes of nodes higher up in the parse tree can be evaluated. The stack is extended to hold the state as well as the value. Top of the stack is maintained in a location pointed by the pointer top.
|