Tuesday 23 January 2018

Compiler Vs Interpreter


Compiler Interpreter
A compiler is a program that can read a program in one language (source language) and translate it into an equivalent program in another language (target language). An interpreter is a program that directly execute a program without compiling it into a machine language.
Diagram
Diagram



It works on the complete program at once. It works line by line on the program.
It takes entire program as input. It takes single instruction as input.
Intermediate object code is generated. No intermediate object code is generated.
More memory is required as intermediate object code is to be stored. Less memory requirement.
Conditional control statements executes faster. Conditional control statements executes slower.
Program need not to be compiled every time. Every time higher level program is converted into lower level program.
Errors are displayed after entire program is checked. Errors are displayed for every instruction interpreted.
It does not allow a program to run until it is completely error free. It runs the program from first line and stops execution only if it encounters an error.
Compiled languages are more efficient but difficult to debug. Interpreted languages are less efficient but easier to debug.
Examples of programming languages that uses compilers are C, C++ etc. Examples of programming languages that uses interpreters are BASIC, Python etc.

No comments:

Post a Comment