As we know that computer understand only the instruction
written in the Machine language. Therefore a program written
in any other language should be translated to Machine language. For this
purpose special programs are available they are called translators or language processors.
This special programs accept the user program and check each statement and
produces a corresponding set of Machine language instructions. There are two
types of Translators.
(1)
Compiler :-
A Compiler checks the entire program
written by user and if it is free from error and mistakes then produces a
complete program in Machine language known as object program. But if it founds
some error in program then it does not execute the single statement of the
program. So compiler translate whole program in Machine language before it
starts execution.
(2)
Interpreters :-
Interpreters performs the similar job
like compiler but in different way. It translates (Interprets) one statement at
a time and if it is error – free then executes that statement. This continues
till the last statement in the program has been translated and executed.
Thus Interpreter translates and
executes the statement before it goes to next statement. When it founds some
error in statement it will immediately stop the execution of the program.
Since compiler of Interpreter can
translate only a particular language for which it is designed one has to use
different compiler for different languages.
Difference
of Compiler – Interpreter :-
Error finding is much easier in
Interpreter because it checks and executes each statement at a time. So
wherever it fine some error it will stop the execution. Where Compiler first
check all the statement for error and provide lists of all the errors in the
program.
Interpreter take more time for the
execution of a program compared to Compilers because it translates and executes
each statement one by one.
0 Comments