Thursday, October 18, 2012

What is a Compiler

A Compiler is a Computer Program that translates or compiles a program written in the high level programming language into the low level programming language.

It is used to cover the gab between the high level language and machine language.

Every high level language has its own syntax that's why the concept of compiler arose... By Compiler the syntax of one language is understood and converted machine understandable language.

The phases of a compiler 

We split the compilation into several phases with well defined interfaces.
The compiler consists of 3 main parts:
  • Front end
    • Lexical analysis
    • Syntax analysis
    • Type checking
  • Intermediate end
    • Intermediate code generation
  • Back end
    • Register allocation
    • Machine code generation
    • Assembly and linking
Each phase, through checking and transformation, establishes stronger in variants on the things it passes on to the next, so that writing each subsequent phase is easier than if these have to take all the preceding into account.