Compiler vs Interpreter : Difference Between Compiler and Interpreter

Compiler vs Interpreter

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

A compiler searches all the errors of a program and lists them. If the program is error free then it converts the code of program into machine code and then the program can be executed by separate commands. An interpreter checks the errors of a program statement by statement.

It is difficult to write and maintain programs in machine level language. The programs written in the code of high level language and low level language need to be converted into machine level language using translators for this purpose.
Translators are just computer programs which accept a program written in high level or low level language and produce an equivalent machine level program as output. Translators are of three types:

  • Assembler
  • Compiler
  • Interpreter

Assembler is used for converting the code of low level language (assembly language) into machine level language.
Compilers and interpreters are used to convert the code of high level language into machine language.The high level program is known as source program and the corresponding machine level program is known as object program. Although both compilers and interpreters perform the same task but there is a difference in their working.
A compiler searches all the errors of a program and lists them. If the program is error free then it converts the code of program into machine code and then the program can be executed by separate commands.
An interpreter checks the errors of a program statement by statement. After checking one statement, it converts that statement into machine code and then executes that statement.

Leave a Reply