Difference between Compiler and interpreter | Compiler vs. Interpreter
Difference between Compiler and interpreter
Compiler |
Interpreter |
|
Scanning |
Compiler scans the entire program first and then translates into machine code. | Interpreter scans and translates the program line by line to equivalent machine code. |
Error Report |
Compiler gives you list of all errors after compilation of whole program. | Interpreter stops the translation at the error generation and will continue when error get solved. |
Machine code |
Compiler converts the entire program to the machine code when all the errors are removed, execution takes place. | Each time the program is executed; every line is check for error and then converted into equivalent machine code. |
Debugging |
Compiler is slow for debugging. | Interpreter is good for fast debugging. |
Execution Time |
Compiler takes less execution time. | Interpreter takes more execution time. |
Speed |
Compiler is faster. | Interpreter is slower in compare to compiler. |
After Modification |
If you make any modification in program you have to recompile entire program i.e. scan the whole program every time after modification. | If you make any modification and if that line has not been scanned then no need to recompile entire program. |
Recompilation |
No need to compile program every time (if not modified) at execution time. | Every time program is scanned and translated at execution time. |
Memory Requirement | Compiler needs more memory than interpreter. | Interpreter needs less memory than compiler. |
Example |
C, COBOL,C#, C++,etc. | VB , PostScript, LISP |