Concepts of Programming Languages
440 Chapter 9 Subprograms Write a Perl program that passes by reference a literal to a subprogram, which attempts to change the ...
441 10.1 The General Semantics of Calls and Returns 10.2 Implementing “Simple” Subprograms 10.3 Implementing Subprograms with St ...
442 Chapter 10 Implementing Subprograms T he purpose of this chapter is to explore the implementation of subprograms. The discus ...
10.2 Implementing “Simple” Subprograms 443 10.2 Implementing “Simple” Subprograms We begin with the task of implementing simple ...
444 Chapter 10 Implementing Subprograms A simple subprogram consists of two separate parts: the actual code of the subprogram, w ...
10.3 Implementing Subprograms with Stack-Dynamic Local Variables 445 memory with the code for MAIN. Then, it had to patch in the ...
446 Chapter 10 Implementing Subprograms Recursion adds the possibility of multiple simultaneous activations of a sub- program, ...
10.3 Implementing Subprograms with Stack-Dynamic Local Variables 447 Activating a subprogram requires the dynamic creation of an ...
448 Chapter 10 Implementing Subprograms The EP is used as the base of the offset addressing of the data contents of the activati ...
10.3 Implementing Subprograms with Stack-Dynamic Local Variables 449 the stack. It is straightforward to modify this approach fo ...
450 Chapter 10 Implementing Subprograms functions fun2 and fun1 terminate. After the return from the call to fun1 from main, the ...
10.3 Implementing Subprograms with Stack-Dynamic Local Variables 451 we assume that all variables take one position in the activ ...
452 Chapter 10 Implementing Subprograms main. The others have a return address to the function itself; these are for the recursi ...
10.3 Implementing Subprograms with Stack Dynamic Local Variables 453 ARI = activation record instance n Functional value Paramet ...
454 Chapter 10 Implementing Subprograms 10.4 Nested Subprograms Some of the non–C-based static-scoped programming languages use ...
10.4 Nested Subprograms 455 is sometimes called a static scope pointer, points to the bottom of the acti- vation record instance ...
456 Chapter 10 Implementing Subprograms ... end of f3 ... end of f2 ... end of f1 The static_depths of the global scope, f1, f2, ...
10.4 Nested Subprograms 457 ... end; -- of Bigsub begin -- of Main_2 ... Bigsub; ... end; -- of Main_2 The sequence of procedure ...
458 Chapter 10 Implementing Subprograms is no visible scope containing a declaration for the variable D, so this reference to D ...
10.4 Nested Subprograms 459 It is reasonable at this point to ask how the static chain is maintained dur- ing program execution. ...
«
19
20
21
22
23
24
25
26
27
28
»
Free download pdf