CpSc 428/628
Pratt-Zelkowitz Exercises: Chapter 2


  1. Suppose that we have an interpreter for a programming language L. In what sense does the interpreter represent a virtual computer?

  2. An instruction on a (virtual) computer with a standard imperative execution mechanism (fetch-execute) represents a function that maps one computer state into another (possibly the same) state. That is, if I is an instruction, then I : state -> state.

    Suppose that we think of a sequence of two instructions, I1 and I2, where first I1 is done and then I2. The combination of I1 followed by I2 just represents a change from the state before I1 to the state after I2 (without regard for the intermediate state). If the combined "instruction" of I1 followed by I2 is denoted I12, what is the relationship between I1, I2, and I12 (as functions)?

  3. For each of the following binding times for programming language components, give an example of a property in C that has the binding time.

    Language definition

    Language implementation

    Translation

    Link edit

    Load

    Execution

  4. For each of the following programming language properties (attributes), give its binding time in C.

  5. What is an example of an identifier attribute for which there is a significant difference in the binding times of ML and C?

Answers