Compiler Architecture
The architecture of a compiler is divided into two phases based on how they work and how they compile a code.
- Analysis Phase
- Synthesis Phase
Analysis Phase
The analysis phase is also called the front-end of a compiler. In this phase, the source program is read and divided into core parts and checked for lexical grammar and syntax errors. It gives an intermediate representation of the symbol table and the source code.
Synthesis Phase
The synthesis phase is also called the back-end of the compiler, the intermediate source code is given as the input to the synthesis phase which generates the target program
A compiler has several phases and passes.
- Pass: A pass is referred to as the traversal of a compiler throughout the entire program.
- Phase: A phase of a compiler is referred to as a distinguishable stage, which takes input from the previous stage, processes, and submits an output that can be used as an input for the next stage.
- One pass can have more than one phase.
Reference Link