ITWissen.info - Tech know how online

interpreter

Interpreters translate the instructions of a source program separately into executable machine code and execute them directly on the specific platform. In contrast to a compiler, the complete source code is not read in, analyzed and executed, but the interpreter processes the instructions line by line.

Interesting variants of the classical interpreter, also and particularly with regard to the execution speed of software, are so-called JIT compilers(Just-In-Time compiler) and interpreters of bytecode, whereby the latter require the installation of a virtual runtime environment, a Virtual Machine( VM).

Interpreters are used, for example, in the translation of programs created in the programming languages Basic, Hypertext Preprocessor( PHP), Perl, Ruby, Python or JavaScript. Well-known languages for bytecode interpreters are Java and C#.

In the following, the basic structures of an interpreter are explained first.

In interpretation, program translationand processing cannot be separated. Source program and input data are processed at the same time. A rough model of an interpreter can be given in the following way:

I = I(L,I,O,f)

with L source language, I input alphabet, O output alphabet, f : L x I*"O*.

The input and output data are formed over the input and output alphabet, respectively.

Input and output model of an interpreter

Input and output model of an interpreter

Each instruction - agreement or statement - of the source program triggers actions of the interpreter. The interpretation of an instruction means its translation and immediate execution. The interpretation of the source program is done in the dynamic i.e. logical order of the agreements and instructions of the source program. Each interpreted instruction determines the following instruction. This results in the following interpretation cycle, which corresponds completely to the internal instruction cycle of a computer of the classical von Neumann architecture:

  1. Deliver the next instruction of the program.
  2. Determine the internal actions (interpreter code) of the interpreter from the analysis of the current instruction.
  3. Execute the internal actions.

However, this also means that the source program or a suitable internal representation must be constantly available during the interpretation. In addition some remarks:

  1. It follows from the interpretation cycle that the interpretation is relatively slow, since in the case of program cycles the instructions of the source program must be translated repeatedly. Therefore, in some realized interpreter systems, a limited number of internal interpreter code instructions are stored in a queue memory. The principle of the queue is that instructions stored first are also released first. In the case of cycle execution, the sequence of stored interpreter code instructions can be processed without going through the DeepL translation if the stored code comprises the complete cycle. Thus, a significantly higher efficiency of the program interpretation is achieved.
  2. Among the advantages of interpretation is that relatively large problems can be handled by interpreter systems even on small systems, since no coherent target program is created. For each kind of the instructions of the source language (e.g. value assignment, conditional statement...) exists only one interpreter code (action) as Subroutine with appropriate parameters or as skeleton of machine code, which are parameterized and afterwards processed after recognition of the appropriate source program instruction.
  3. Interpreter systems provide excellent opportunities for program development in connection with testing and error diagnostics.
  4. Interpretative methods are very significant for computer applications. For example, dialog systems are interpreter systems just as the control of operations in operating systems by commands or command files is interpretive.

The special techniques for the development of interpreters are comparable to those, which are used also in the compiler construction. From it further modified concepts of the interpretation of program code developed such as JIT Compiler and byte code interpreter, which make above all speed advantages possible. Thereby the Just in time compiler is a platform-dependent alternative of the translation of program code. Here machine code is stored temporarily and the binary code is optimized more strongly.

With bytecode interpreters the complete program code is transformed first into an intermediate code - the bytecode. This is independent of a platform and requires the corresponding virtual runtime environment ( virtual machine) adapted to the respective platform for execution.

A traditional application of interpreters is the Basic programming language, but many applications on the Internet are also written in modern scripting languages such as JavaScript.

Informations:
Englisch: interpreter
Updated at: 29.10.2013
#Words: 704
Links: program, code, platform, indium (In), contrast
Translations: DE
Sharing:    

All rights reserved DATACOM Buchverlag GmbH © 2022