Sunday, 4 January 2015

Difference between Compiler and Interpreter

It is a translating program that translates instructions of a high level language into machine language.
It is also a translating program to convert high level instructions into machine language.
Whole source program is translated into object program, whole resulting code (Object Code) is executed.
Translation is done line by line; one instruction is translated and then executed. This process is performed for each and every line of the program.
Whole program is executed and errors are displayed at the end.
Next instruction is not executed until errors are not removed from previous line.
Translation is fast.
Slow, because each statement must be translated every time it is executed from source program.

Error Handling
Difficult, Because are removed from whole program.
Easy, because errors are removed line by line.
These are large programs which reside permanently on secondary storage.
These programs are small and are very easy to write and do not require large memory space.
Object Code
Obtained object code is saved for future use and is used every time the program is to be executed, hence e no repeated compilation is done for repeated execution of program.
No object code is saved for future use because translation and execution processes alternate. The nest time an instruction is executed; it must once again be interpreted and translated into machine language.

Used Terms:
Source Code: It is the code that is to be converted from high level language to machine level language.
Object Code: It is the code that is obtained from by converting high level program code into machine language code.
Translator: It is a program that translates a program written in given programming language into a functionally equivalent program in a different computer Language.
Execution: It is the process by which a Computer or Virtual Machine performs instructions of a computer Program.
This also applies to:
Difference between Compiler and Interpreter
Compiler vs Interpreter
Distinguish Between Compiler and Interpreter

No comments:

Post a Comment