.Open CS320/12 Implementing Subprograms (Chapter 10) .Table .Row Prev 11 LISP Chapter 2 section 4 + LISP handout lab11 LISP101 .Row 12 Implementing subprograms Chapter 10 lab12 LISP102 .Row Next 13 Functional Programming Chapter 15 not section 8 lab13 LISP103 .Close.Table . Preparation Study the $Notes below. Sudy Chapter 10. Think about the $Notes and the reading. Answer the chapter's review questions. Hand in answers to 2 or more review questions. .Open Notes (1) You need to describe the activation records for several kinds of language. (2) You need to describe the activation records for several kinds of language using the UML. (3) Variables declared in a C program can be global - visible to all parts of the program, or local to a file (static external), or be local to a particular block. A subprogram can only be local to a file or global. So, functions are never declared inside another function and so the referencing environment of functions can never contain variables that are local to other functions. This means that the compiler does not need to keep track of them. It lets the linker handle global variables and functions. So C has simpler Activation Records than Algol or Pascal. (4) In nearly all modern languages data is stored in two places: the .Key stack and the .Key heap The data on the stack is created (pushed) and deleted(popped) automatically as the blocks and subprograms are entered and exitted, respectively. However, data on the heap is created by special explicit operators like the "new" operator in Java and C++. It continues to exist after the subprogram or block in which it was created terminates. It is accessed indirectly by a pointer. If all the pointers to a piece of heap data are deleted then the data becomes garbage -- it takes up space that can be recycled. Java automatically .Key collects the garbage and lets the program reuse the memory space. C++ does not -- and the programmer must do it themselves. .Close . Class Work .See ./12q.html . Lab Work -- More LISP .See ./lab/12.html . Next -- Functional Programming .See ./13.html