
132 An Introduction to Compiler Construction in a Java World
FIGURE 4.2 The structure of a context.
The pointer surroundingContext points to the context for the surrounding region of
scope; the chain of these pointers is the stack that captures the nested scope in j-- programs.
The pointer compilationUnitContext points to the context for the enclosing compilation
unit, that is, a CompilationUnitContext. In the current definition of j--, there is just one
compilation unit but one might imagine an extension to j-- permitting the compilation of
several files, each of which defines a compilation unit. The pointer classContext points to
the context (a ClassContext ...