Translator
- It is a computer program that translates high level programming language code into machine code.
- Three type of translate programs are available.
[1] Interpreter:
- An Interpreter is a computer program that performs translation of high level programming code into the machine language.
- It converts one line at a time and then executes it.
- First it converts source code into and intermediary code and then executes it statement by statement.
- An Interpreter program executes slower than compiled program.
- If an error is found, it stops translation.
- An assembler is a one type of translator program.
- It converts assembly language program into the machine language code.
- It scans all the mnemonic op-code into the machine code.
- An assembler generates object code from the assembly language code.
[3] Compiler:
- A Compiler is a computer program that converts high level language code in to machine code.
- It translates the whole program at a time.
- Since, the whole program is converted at a time, it executes much faster.
- After translation, the compiler generates error report if any error is found.
- Converted program code is also known as object code.
Difference: Compiler v/s Interpreter:
Compiler | Interpreter |
It compiles the whole program at a time. | It converts source program one line at a time. |
Its execution speed is faster compare to interpreter. | Since it converts the code line by line, execution speed is slow. |
It first converts whole program and shows error reports at last if any error is found. | It stops translation as soon as it found error. |
Performance of the compiled program is better than the interpreted program. | Performance is poor compare to compiled program. |
It does not provide facility to stop and resume compilation process. | It can be stop and resume during the interpretation. |