
Chapter 4
Type Checking
4.1 Introduction
Type checking, or more formally semantic analysis, is the final step in the analysis phase. It
is the compiler’s last chance to collect information necessary to begin the synthesis phase.
Semantic analysis includes the following:
• Determining the types of all names and expressions.
• Type checking: insuring that all expressions are properly typed, for example, that the
operands of an operator have the proper types.
• A certain amount of storage analysis, for example determining the amount of storage
that is required in the current stack frame to store a local variable (one word for ints,
two words for longs).