Control Stack The flow of the control in a program corresponds to a depth-first traversal of the activation tree that: starts at the root. visits a node before its children,and recursively visits children at each node an a left-to-right order A stack (called control stack)can be used to keep track of live procedure activations. An activation record is pushed onto the control stack as the activation starts. That activation record is popped when that activation ends. When node n is at the top of the control stack,the stack contains the nodes along the path from n to the root. CS308 Compiler Theory 7Control Stack • The flow of the control in a program corresponds to a depth-first traversal fh i i h l of the activation tree that: – starts at the root, – visits a node before its children, and – recursively visits children at each node an a left-to-right order. • A stack (called control stack) can be used to keep track of live procedure activations. – A i i di h d h l k h An activation record is pushed onto the control stack as the activation starts. – Th t ti ti d i d h th t ti ti d That activation record is popped when that activation ends. • When node n is at the top of the control stack, the stack contains the nodes along the path from n to the root CS308 Compiler Theory 7 nodes along the path from n to the root