Compiler vs Interpreter: Difference


Difference between Compiler and Interpreter:

No
Compiler
Interpreter



1
Compiler Takes Entire program as
Interpreter Takes Single instruction

input
as input .



2
Intermediate Object Code is
No Intermediate Object Code is

Generated
Generated




3
Conditional Control Statements are
Conditional Control Statements are

Executes faster
Executes slower



4
Memory Requirement : More
Memory Requirement is Less

(Since Object Code is Generated)




5
Program need not be compiled
Every time higher level program is

every time
converted into lower level program



6
Errors are displayed after entire
Errors are displayed for every

program is checked
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.