What is Compiler ?

Definition of Compiler :

  1. A computer program which reads source code and outputs assembly code or executable code is called compiler.
  2. 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.
  3. 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()

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.
Compiler Converts C Program into Binary Language

Different Phases of Compiler

  1. Lexical Analysis Phase
  2. Syntax Analysis
  3. Semantic Analysis
  4. Intermediate Code Generation
  5. Code Optimizer
  6. Code Generation