1. Procedure call
2. Activation tree
3. Control stack
4. The scope of declaration
5. Bindings of names
- A procedure definition is a declaration that associates an identifier with a statement.
- The identifier is the procedure name and the statement is the procedure body.
- For example, the following is the definition of procedure named readarray:
Procedure readarray
Var i: integer;
Begin
For i=1 to 9 do real(a[i])
End;
- When a procedure name appears within an executable statement, the procedure is said to be called at that point.
2. Activation tree
- An activation tree is used to depict the way control enters and leaves activations. In an activation tree,
- Each node represents an activation of a procedure.
- The root represents the activation of the main program.
- The node for a is the parent of the node b if and only if control flows from activation a to b.
- The node for a is to the left of the node for b if and only if the lifetime of a occurs before the lifetime of b.
3. Control stack
- A control stack is used to keep track of live procedure activations.
- The idea is to push the node for activation onto the control stack as the activation begins and to pop the node when the activation ends.
- The contents of the control stack are related to paths to the root of the activation tree.
- When node n is at the top of the stack, the stack contains the nodes along the path from n to the root.
4. The scope of declaration
- A declaration is a syntactic construct that associates information with a name.
- Declaration may be explicit, such as:
var i: integer;
- Or they may be implicit. Example, any variable name starting with i is assumed to denote an integer.
- The portion of the program to which a declaration applies is called the scope of that declaration.
5. Bindings of names
- Even if each time name is declared once in a program, the same name may denote different data objects at run time.
- “Data object” corresponds to a storage location that holds values.
- The term environment refers to a function that maps a name to a storage location.
- The term state refers to a function that maps a storage location to the value held there.