What is the difference between Compiler and Interpreter?


A compiler is a computer program that reads a program written in a high-level language such as FORTRAN, PL/I, COBOL, etc. It can translate it into the same program in a low-level language including machine language. The compiler also finds out the various errors encountered during the compilation of a program.

The compiler converts high-level language into low-level language using various phases. A character stream inputted by the customer goes through multiple stages of compilation which at last will provide target language.

Advantages of Compiler

There are various advantages of the compiler which are as follows −

  • A compiler translates a program in a single run.

  • It consumes less time.

  • CPU utilization is more.

  • Both syntactic and semantic errors can be checked concurrently.

  • It is easily supported by many high-level languages like C, C++, JAVA, etc.


An interpreter is a program that executes the programming code directly instead of just translating it into another format. It translates and executes programming language statements one by one. An interpreter takes less time to interpret a source program as distinguished by a compiler.

Advantages of Interpreter

There are various advantages of the interpreter which are as follows −

  • An interpreter translates the program line by line.

  • The interpreter is smaller in size.

  • It is flexible.

  • Error localization is easier.

  • The interpreter facilitates the implementation of computer programming language constructs.

Let us see the comparison between the Compiler and the Interpreter.

A compiler translates the entire source code in a single run.
An interpreter translates the entire source code line by line.
It consumes less time i.e., it is faster than an interpreter.
It consumes much more time than the compiler i.e., it is slower than the compiler.
It is more efficient.
It is less efficient.
CPU utilization is more.
CPU utilization is less as compared to the compiler.
Both syntactic and semantic errors can be checked simultaneously.
Only syntactic errors are checked.
The compiler is larger.
Interpreters are often smaller than compilers.
It is not flexible.
It is flexible.
The localization of errors is difficult.
The localization of error is easier than the compiler.
A presence of an error can cause the whole program to be re-organized.
A presence of an error causes only a part of the program to be re-organized.
The compiler is used by the language such as C, C++.
An interpreter is used by languages such as Java.