A compiler is a program that reads a program in one language, the source language and translates into an equivalent program in another language, the target language.
The translation process should also report the presence of errors in the source program.
|Source Program||→||Compiler||→||Target Program|
There are two parts of compilation.
The analysis part breaks up the source program into constant piece and creates an intermediate representation of the source program.
The synthesis part constructs the desired target program from the intermediate representation.
Phases of Compiler
The compiler has a number of phases plus symbol table manager and an error
|Input Source Program|
|Symbol Table Manager||Semantic Analyzer||Error Handler|
|Intermediate Code Generator|
|Out Target Program|
The cousins of the compiler are
Front End vs Back End of a Compilers. The phases of a compiler are collected into front end and back end.
The front end includes all analysis phases end the intermediate code generator.
The back end includes the code optimization phase and final code generation phase.
The front end analyzes the source program and produces intermediate code while the back end synthesizes the target program from the intermediate code.
A naive approach (front force) to that front end might run the phases serially.