Why Theory?
|-------| |--------| |----------| |-----------|
Source → | Lexer | → tokens → | Parser | → parse → | Semantic |→ AST → | IR | → IR1
Program | | | | tree | Analyzer | | Generator |
|-------| |--------| |----------| |-----------|
|--------------| |--------------| |--------------| |-------------|
IR1 → | Optimization | → IR2 → | Optimization | → IR3 → | Optimization | → ... → | Code | → Target
| Pass 1 | | Pass 2 | | Pass 3 | | Generator | Program
|--------------| |--------------| |--------------| |-------------|
- How do you know that the meaning of the target program is the same as the source program?