optional · CSS study notes
Phases of a Compiler
- Lexical Analysis — groups characters into tokens
- Syntax Analysis — checks token sequence against grammar, builds a parse/syntax tree
- Semantic Analysis — checks meaning/type-correctness, builds/uses a symbol table
- Intermediate Code Generation — produces a machine-independent intermediate representation
- Code Optimization — improves the intermediate code's efficiency
- Code Generation — produces final target/machine code
MCQ Trap
- This six-phase order (Lexical → Syntax → Semantic → Intermediate Code → Optimization → Code Generation) is one of the most reliably tested sequences in this topic.