Scanning

Parsing

Semantic Analysis

Optimization

Code Generation

Tradeoffs

Other System Software

Portability

Benchmarks

Validations

12.2.3 Semantic Analysis

Semantic analysis is the bridge between parsing and code generation. The levels and number of intermediate representations depend upon the goals of the compiler. Trees are simplest; graphs may be required for serious optimizations.

For small and fast, it is desirable to minimize the number of visits to each node; for example Sethi-Ullman numbering may be done as the abstract syntax tree is generated. Perhaps the object code may be emitted directly, although this will result in poorer quality code.