Compiler vs Interpreter : Difference



Difference between Compiler and Interpreter

No Compiler Interpreter
1 Compiler Takes Entire program as input Interpreter Takes Single instruction as input .
2 Intermediate Object Code is Generated 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 compiled every 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

Explanation : Compiler Vs Interpreter

Just understand the concept of the compiler and interpreter –

  1. We give complete program as input to the compiler. Our program is in the human readable format.
  2. Human readable format undergoes many passes and phases of compiler and finally it is converted into the machine readable format.
  3. However interpreter takes single line of code as input at a time and execute that line. It will terminate the execution of the code as soon as it finds the error.
  4. Memory requirement is less in Case of interpreter because no object code is created in case of interpreter.

Following video will say much more about compiler –

Video Explanation :