Structure of a Compiler
1.Lexical Analysis - 词法分析
divides program text into words or tokens
first step: recognize words
- Smallest unit ablove letters
2.Parsing - 语法分析
diagramming sentences - 图解句子结构
3.Semantic Analysis
- compilers perform limited semantic analysis to catch inconsistencies
- compilers perform many semantic checks besides variable bindings
4.Optimization
has no strong counterpart in English
- But a little bit like editing
Automatically modify programs so that they
- Run faster
- Use less memory
5.Code Genaration
produces assembly code(usually)
A translation into another language
- Analogous to human translation