What is Compiler ?
Definition of Compiler :
- A computer program which reads source code and outputs assembly code or executable code is called compiler.
- A program that translates software written in source code into instructions that a computer can understand Software used to translate the text that a programmer writes into a format the CPU can use.
- A piece of software that takes third-generation language code and translates it into a specific assembly code. Compilers can be quite complicated pieces of software.
Compiler Overview :
Consider process of Executing Simple C Language Code -
We have opened C Code editor and wrote simple C Program , Whenever we try to compile code and try to execute code our code is given to the compiler.
int main() { printf("Hello"); return(0); }
Now our main intention is to convert program into lower level language which can be read by Machine. Compiler have different phases , and program undergoes through these 6 phases. After Passing through all the compilation Phases our code is converted into the machine level language code which can be read by machine.
Different Phases of Compiler
- Lexical Analysis Phase
- Syntax Analysis
- Semantic Analysis
- Intermediate Code Generation
- Code Optimizer
- Code Generation