أنشئ حسابًا أو سجّل الدخول للانضمام إلى مجتمعك المهني.
A compiler just checks all syntax errors of a source program. If the source program has no errors then it transforms the source code into machine code (binaries) and then the program can be executed by invoking several library commands and a linker. An interpreter simply checks the errors of a program statement by statement. It cannot consider the whole program as a single unit.
Interpreter performs step by step translation, and stops when a error occurs.
Compiler translate the entire program and highlight all errors if any
Input
Compiler Takes Entire program as input
Interpreter Takes Single instruction as input .
Intermediate Code
Intermediate Object Code is Generated
No Intermediate Object Code is Generated
Compilation
Program need not be compiled every time
Every time higher level program is converted into lower level program
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.
Example
C Compiler
BASIC