What is a Compiler and Interpreter?

What is a Compiler and Interpreter ?

Before continuing this post if you have not seen our previous post on Introduction to Computer Programming ,then read that post and then continue here for good understanding of the concept.
Links to my previous posts :

As seen before a Translator translates a source code to Target code.
here the source code is a high level language and target code is machine code.
There are two types of translator 
  • Compiler
  • Interpreter

Compiler :
A  Compiler is a computer program that translates the High level language(source code) to low level language(Machine code) as a whole.If there is any error in the source code the compiler can show it only after the whole code is executed.

There are six phases in a compiler .they are as shown below
There are various types of compiler such as

  • Native code compiler
  • Cross compiler
  • Source to source compiler
  • One pass compiler
  • Incremental compiler etc..

Interpreter:
An Interpreter also converts the high level language into low level language but they compile the source code line by line.(i.e. the interpreter first checks the first line of code and if there is any error it reports the error and next lines of code will not be compiled.)
Lets discuss how a program is executing in our next post......Thank you... 


Popular Posts