Interpreters are programs that, unlike a compiler, do not read the entire code first as a whole, they instead read each line of the source program separately and run it directly on the platform without translating the code first. Each analysis thus occurs while the program is running. Interpreters are used by Java, for example.


The value of interpreters is that a program can skip the translation of the source code and simply execute the instructions in the code directly. The work of the interpreter is, therefore, to implement exactly those routines that were recorded by the respective developer.

While interpreting the source code, translation and execution of the code are not separate steps. Input and source code are executed simultaneously. Each line with an instruction results in immediate action by the interpreter. You could therefore say that an interpreter performs two steps at the same time, i.e., translation and execution. One step follows the next in logical order according to the specifications of the source code.


Pros and cons[edit]

The advantages in the use of compilers are that these programs are very efficient specifically for debugging, in other words, the identification of bugs, because they will simply stop working when there are errors. If the interpreter stops, programmers can respond immediately and resolve the error. A disadvantage is that an interpreter is significantly slower than a compiler. Because each row is read, including repetitive elements.

This disadvantage in work speed is partially offset by modifications such as the JIT (Just-in-time compiler) or bytecode interpreter.

Interpreter languages[edit]

Programs that have been written in the following languages can be implemented by interpreters:

  • Basic
  • Ruby
  • PHP
  • Perl