Compiler Vs Interpreter
Let’s see the main differences between Compiler Vs Interpreter. Both compiler and interpreter act differently in many aspects.
Difference between Compiler and Interpreter
COMPILER
- Compiler takes an entire program as input. It works on the complete program at once
- It generates Intermediate Object code (machine code)
- It executes Conditional control statements faster than Interpreter
- More memory required (since Object Code is generated)
- Compiled program doesn’t need to be compiled every time
- Errors are displayed after entire program is checked
- Programming languages that use compilers are C, C++
INTERPRETER
- Interpreter takes a single statement at a time as input. It works line by line
- It doesn’t generate Intermediate code (machine code)
- It executes Conditional control statements much slower than Compiler
- Memory requirement is less. It doesn’t generate intermediate Object Code
- Every time higher level program is converted into lower level program
- Errors are displayed for every instruction interpreted (if any)
- Programming languages that use interpreter are Visual Basic Script, Ruby, Perl
COMPILER | INTERPRETER |
---|---|
Compiler takes an entire program as input. It works on the complete program at once | Interpreter takes a single statement at a time as input. It works line by line |
It generates Intermediate Object code (machine code) | It doesn’t generate Intermediate code (machine code) |
It executes Conditional control statements faster than Interpreter | It executes Conditional control statements much slower than Compiler |
More memory required (since Object Code is generated) | Memory requirement is less. It doesn’t generate intermediate Object Code |
Compiled program doesn’t need to be compiled every time | Every time higher level program is converted into lower level program |
Errors are displayed after entire program is checked | Errors are displayed for every instruction interpreted (if any) |
Programming languages that use compilers are C, C++ | Programming languages that use interpreter are Visual Basic Script, Ruby, Perl |