c. Consider an activation record and an activation record instance. Which is like a class and which is an object?
d. Using the UML draw a class diagram of the RunTimeStack, the ActivationRecords, and the relations between them in a typical high-level language. Show the normal stack operations in the RunTimeStack. Show no operations or attributes for the ActivationRecord.
Answer: [ ole4.gif ]
d. Give three(3) reasons why implementing subprograms in an ALGOL-like language is more difficult than implementing subprograms in a language like FORTRAN-77.
100 GOSUB 1000(No parameters, no name, just a line number) and a typical subprogram ends
1099 RETURN(nothing returned... but the interpreter jumps back to the statement after the last GOSUB).
Answer: [ ole3.gif ]
b. Draw a UML diagram of an activation record for a language like FORTRAN-77.
Answer: [ ole.gif ]
c. Draw a UML diagram of an activation Record for a language like Algol, Pascal or Ada
Answer: [ ole1.gif ]
d. Draw a UML diagram of an activation record for a language like C or Java 1. (No functions declared inside functions...).
Answer: [ ole2.gif ]
Note: In JavaScript the activation record is explicit and available to the programmer!
b. Explain how a static chain is used to bind an identifier occurrence to the correct non-local declaration.
a. Draw diagram (using the UML) of Programs, SubprogramCalls, SubprogramDefinitions (if any) in L. (Note. Draw classes and relations, no operations of attributes)
b. Use the diagram to explain how subprogram calls can be implemented in L.