Interpreter converts source code written in High level Language into machine code line by line and then created executable file.
An interpreter may be a program that either
- executes the source code directly.
- translates source code into some efficient intermediate representation or code and immediately executes this.
- explicitly executes stored pre-compiled code made by a compiler which is a part of the interpreter system.
A program that executes instructions written in a High-level language. An interpreter translates High level instruction into an intermediate form, which it then executes.
Advantages of Interpreter:
- Interpreters are useful for program development when execution speed is not important. As the interpreter is in command of the execution process debugging features can be build in.
- Debugging is easier since the interpreter stops when it encounters an error. Is an error is deducted there is no need to re translate the whole program.
- There is no lengthy “compile time”, i.e. you do not have to wait between written a program and running it, for it to compile. As soon as you have written a program, you can run it.
Disadvantages of Interpreter:
- Interpreters normally translate and execute programs line by line, converting each program statement into a sequence of machine code instructions and executing these instructions without retaining the translated version.
- No object code is produced, so a translation has to be done every time the program is running. Source code is required for the program to be executed.
A compiler is a computer program that translates source code or program written in High level Language into machine code and created an executable file. The original sequence is usually called the source code and the output called object code. Commonly the output has a form suitable for processing by other programs, but it may be human readable text file.
A utility program called an assembler is used to translate assembly language statements into the target computer’s machine code. The assembler performs a more or less isomorphic translation from mnemonic statements into machine instructions and data.
Advantages of Assembler:
- Programs written in machine language are replaced by mnemonics which are easier to remember.
- Easy to make insertions and deletions.
- It is not required to keep track of memory locations.
- Requires fewer instructions to accomplish the same result.
Disadvantages of Assembler:
- Programs written in such language cannot be executed on small sized computers.
- Ii takes lot of time to code or write the program, as it more complex in nature.
- Lack pf portability of program between computers of different makes.