Wednesday, 7 June 2017

What is the difference between Compilers and Interpreters?




SN Compiler Interpreter
1 Compiler works on complete program at once i.e. Compiler take complete program as input. Interpreter works line by line i.e. Interpreter takes one line as input at one time instance.
2 Compiler generates intermediate code i.e. object code. Interpreter does not generate intermediate code.
3 Compiler takes more memory as it generates intermediate code which has to be saved in memory. Interpreter is memory efficient as it does not generate intermediate object code.
4 Programs need to be compiled once and can be run any number of times. Interpreter has to work every time for the same program.
5 Compiler check the whole program and report all the errors at the end. Interpreter report the error as soon as it encounters error and stop working.
6 Compiler executes conditional control statements(e.g. if-else, switch) faster than Interpreter. Interpreter executes conditional control statements slower than Compiler.
7 C, C++ Python, Basic

No comments:

Post a Comment