Overview of Compiler
Compiler is a program (written in high-level language) that converts/translates/compiles source program written in a high level language into an equivalent machine code
Source program ——— compiler ———-> machine code
Compiler are written in a high level language . Sometimes a compiler is written in the same language for which one is writing a compiler . This is done through Bootstrapping.
Phases of Compiler
- Intermediate-code Generator (Produces Intermediate code)
- Intermediate-code optimizer (produces optimized intermediate code)
- Target-code generator (Produces target Machine code)
One of the primary data structure that a compiler uses is a symbol table. This data structure is used by all of the phases.
Compilers may generate three types of code:
- pure machine code
- augmented code
- virtual machine code