What is Compiler ?

C is a middle or low level language programming language. So we need to convert this into binary language . To convert high level language into low level or binary language we need Translators.
  • Compiler is a translator ,which translate a program written in high-level language into binary language (machine language).
  • Compiler translate the entire source program into object program at once.
  • In compiler , intermediate object code is generated , condition control statements are execute faster.
 Example of compiler:- GCC, c compiler. 

What is Interpreter ?

Interpreter translate a program written in high -level language into machine language. And it is also involved in its execution.
  • Interpreter translate entire source of program into object program line by line and immediately executes.
  • It takes single instruction as input, there is no intermediate object code is generated.
  • In interpreter memory requirements is Less.
  • Every time interpreter convert higher level program into lower level program.

Example:- BASIC


Difference Between compiler and interpreter

S.NO.COMPILERINTERPRETER
1Compiler Takes Entire program as input .Interpreter Takes Single instruction as input.
2Intermediate Object Code is Generated..No Intermediate Object Code is Generated.
3Conditional Control Statements are Executes faster.Conditional Control Statements are Executes slower.
4Memory Requirement: More(Since Object Code is Generated).Memory Requirement is Less.
5Program need not be compiled every time.Every time higher level program is converted into lower level program
6Errors are displayed after entire program is checkedErrors are displayed for every instruction interpreted (if any)
7Example:C CompilerExample: BASIC

Role of Compiler

  1. Compiler reads the source code, outputs executable code
  2. Translates software written during a higher-level language into instructions that computer can understand. It converts the text that a programmer writes into a format the CPU can understand.
  3. The process of compilation is relatively complicated. It spends a lot of time analyzing and processing the program.
  4. The executable result's some sort of machine-specific code .

Role of Interpreter

  1. The interpreter converts the source code line-by-line during RUN Time.
  2. Interpret completely translates a program written during a application-oriented language into machine level language.
  3. Interpreter allows evaluation and modification of the program while it's executing.
  4. Relatively less time spent for analyzing and processing the program.
  5. Program execution is relatively slow compared to compiler.