A
compiler is a program that translates the entire source program written
in some high-level programming language (such as Java) into machine
code for some computer architecture (such as the Intel Pentium
architecture).
- A computer program which reads entire source code and outputs assembly code or executable code is called compiler.
- A
program that translates software written in source code into
instructions that a computer can understand Software used to translate
the text that a programmer writes into a format the CPU can use.
- A piece of software that takes third-generation language code and translates it into a specific assembly code. Compilers can be quite complicated pieces of software.
-
An
Interpreter is a program that translates a source program written
in some high-level programming language (such as BASIC) into machine
code for some computer architecture (such as the Intel Pentium
architecture) line by line.
- A computer program which reads line by line source code and outputs assembly code or executable code is called interpreter.
Difference between Compiler and Interpreter
No | Compiler | Interpreter |
1 | Compiler Takes Entire program as input | Interpreter Takes Single instruction as input . |
2 | Intermediate Object Code is Generated | No Intermediate Object Code is Generated |
3 | Conditional Control Statements are Executes faster | Conditional Control Statements are Executes slower |
4 | Memory Requirement : More (Since Object Code is Generated) | Memory Requirement is Less |
5 | Program need not be compiled every time | Every time higher level program is converted into lower level program |
6 | Errors are displayed after entire program is checked | Errors are displayed for every instruction interpreted (if any) |
7 | Example : C Compiler | Example : BASIC |