An interpreter is a program that executes the instructions of a high-level program line by line. The interpreter loads the source code and translates the instructions into an intermediate language that can then be executed.
Interpreters generate binary code that is interpreted each time the program is run, unlike the compiler which creates an executable file. Examples of programs that use interpreters are BASIC, and Visual Basic. In VB you can compile the entire program to create an executable or you can run one form or module at a time, in which case an interpreter is involved.
Interpreted languages are easier to learn than compiled languages. An interpreter lets the programmer immediately know when and where problems exist in the code whereas compiled programs make the programmer wait until the program has completed.
The advantages of using an interpreter are:
- By running line by line, it is easier to debug and check for errors.
- If the program is very long, an interpreter turns out to be faster than a compiler because it doesn’t have to translate the entire program to run it.
The disadvantages of using an interpreter are:
- Source code is required in order to run a program
- Interpreters are slower than compiled or executable programs.