Scanning

Parsing

Semantic Analysis

Optimization

Code Generation

Tradeoffs

Other System Software

Portability

Benchmarks

Validations

12.2.2 Parsing

The parsing method must be decided (see the summary to Module 5). If the parser is to be built from the BNF in a language design that is not LL(1), then LR(1) (LALR(1), more specifically) is the method of choice. Good error recovery is a difficult part of this phase, no matter what parsing method is chosen. Again, simple is better and parsing should consist of syntax analysis; static checking and other semantic analyses can be pushed off to the semantic analysis.

Again, for a small, fast compiler, the advice may be just the opposite: syntax analysis should be tightly coupled with semantic analysis.