Runtime Environments Chapter 7 in textbook. Run-Time Environments. A lot has to happen at run time to get your program running. At run time, we need a system to map NAMES (in the source program) to STORAGE on the machine.
var a: array [ 0..10 ] of integer;
function partition( y, z: integer ) : integer;
procedure quicksort( m, n: integer );
This partial activation tree corresponds to control stack (growing downward)
let Sqr x = x * x
let f a b = Sqr a + b
Print(f 4 3 + (let Sqr x = x+x in f 4 3)) )
Scopes defined by modules, which explicitly export names to:
t = a;
a = b;
b = t;
(a+bfor ints and reals).
Static notionDynamic counterpart
definition of a procedure activations of the procedure
declarations of a name bindings of the name
scope of a declaration lifetime of a binding
Acontrol linkfrom record A points to the previous record on the stack. The chain of control links traces the dynamic execution of the program.
Anaccess linkfrom record A points to the record of the closest enclosing block in the program. The chain of access links traces the static structure (think: scopes) of the program.