Türkçe ansiklopedi, sözlük, genel başvuru ve bilgi sitesi   
 
  Yardım
  Rastgele    

Interpreter (computing)

In computer science, an interpreter is a computer program that executes, or performs, instructions written in a computer programming language. Interpretation is one of the two major ways in which a programming language can be implemented, the other being compilation.

The term interpreter may refer to a program that executes source code that has already been translated to some intermediate form, or it may refer to the program that performs both the translation and execution (e.g., many BASIC implementations).

Interpreted vs compiled languages

Any language can be implemented via an interpreter or compiler; there is no such thing as an "interpreted language" or "compiled language", only interpreted and compiled implementations of a language. Indeed, a single program may contain parts that are implemented via interpreter and a compiler, e.g., some Lisp systems. Nonetheless, certain languages are best known for having particular kinds of implementations, and because of this are often termed "compiled" or "interpreted" languages (although technically these terms are more accurately reserved for implementations).

Many "interpreters" today include some element of compilation as well, such as a bytecode compiler, as found in Perl and Python. In such an arrangement, source code is compiled to a more efficient intermediate form, which is then interpreted.

Efficiency

The main disadvantage of interpreters is that when a program is interpreted, it runs slower than if it had been compiled. The difference in speeds could be tiny or great; often an order of magnitude and sometimes more. It generally takes longer to run a program under an interpreter than to run the compiled code but it can take less time to interpret it than the total time required to compile and run it. This is especially important when prototyping and testing code when an edit-interpret-debug cycle can often be much shorter than an edit-compile-run-debug cycle.

Interpreting code is slower than running the compiled code because the interpreter must analyze each statement in the program each time it is executed and then perform the desired action whereas the compiled code just performs the action. This run-time analysis is known as "interpretive overhead". Access to variables is also slower in an interpreter because the mapping of identifiers to storage locations must be done repeatedly at run-time rather than at compile time.

There are various compromises between the development speed when using an interpreter and the execution speed when using a compiler. Some systems (e.g., some LISPs) allow interpreted and compiled code to call each other and to share variables. This means that once a routine has been tested and debugged under the interpreter it can be compiled and thus benefit from faster execution while other routines are being developed. Many interpreters do not execute the source code as it stands but convert it into some more compact internal form. For example, some BASIC interpreters replace keywords with single byte tokens which can be used to find the instruction in a jump table. An interpreter might well use the same lexical analyzer and parser as the compiler and then interpret the resulting abstract syntax tree.

Bytecode interpreter

There is a spectrum of possibilities between interpreting and compiling, depending on the amount of analysis performed before the program is executed. For example, Emacs Lisp is compiled to bytecode, which is a highly compressed and optimized representation of the Lisp source, but is not machine code (and therefore not tied to any particular hardware). This "compiled" code is then interpreted by a bytecode interpreter (itself written in C). The compiled code in this case is machine code for a virtual machine, which is implemented not in hardware, but in the bytecode interpreter. The same approach is used with the Forth code used in Open Firmware systems: the source language is compiled into "F code" (a bytecode), which is then interpreted by a virtual machine.

Just-in-time compilation

Just-in-time compilation, or JIT, refers to a technique where bytecode is compiled to native machine code at runtime; giving the high execution speed of running native code at the cost of increased startup-time as the bytecode is compiled. It has gained attention in recent years, which further blurs the distinction between interpreters, byte-code interpreters and compilation. JIT is available for both the .NET and Java platforms. The JIT technique is a few decades old, appearing in languages such as Smalltalk in the 1980s.

Example of a simple interpreter

There is an example of a simple program and interpreter in the Literate programming article. See also: Lisp in Small Pieces

Punched card interpreter

The term "interpreter" often referred to a piece of unit record equipment that could read punched cards and print the characters in human-readable form along the top edge of the card. The IBM 550 Numeric Interpreter and IBM 557 Alphabetic Interpreter are typical examples from 1930 and 1954, respectively.

See also

External links

This article was originally based on material from the Free On-line Dictionary of Computing, which is licensed under the GFDL.
Computer science, or computing science, is the study of the theoretical foundations of information and computation and their implementation and application in computer systems.
..... Click the link for more information.
A computer program is one or more instructions that are intended for execution by a computer. Specifically, it is a symbol or combination of symbols forming an algorithm that may or may not terminate, and that algorithm is written in a programming language.
..... Click the link for more information.
Execution in computer and software engineering is the process by which a computer or virtual computer carries out the instructions of a computer program. The term run is used almost synonymously.
..... Click the link for more information.
A programming language is an artificial language that can be used to control the behavior of a machine, particularly a computer. Programming languages, like natural languagess, are defined by syntactic and semantic rules which describe their structure and meaning respectively.
..... Click the link for more information.
compiler is a computer program (or set of programs) that translates text written in a computer language (the source language) into another computer language (the target language).
..... Click the link for more information.
source code (commonly just source or code) is any sequence of statements and/or declarations written in some human-readable computer programming language.
..... Click the link for more information.
Basic may be:
..... Click the link for more information.
Lisp
Paradigm: multi-paradigm: functional, procedural, reflective
Appeared in: 1958
Designed by: John McCarthy
Developer: Steve Russell, Timothy P. Hart, and Mike Levin
Typing discipline: dynamic, strong
Dialects: Common Lisp, Scheme, Emacs Lisp
..... Click the link for more information.
Perl

Paradigm: Multi-paradigm
Appeared in: 1987
Designed by: Larry Wall
Latest release: 5.8.8/ January 31 2006
Typing discipline: Dynamic
Influenced by: AWK, BASIC, BASIC-PLUS, C, C++, Lisp, Pascal, Python, sed, Unix shell
..... Click the link for more information.
Python

Paradigm: Multi-paradigm
Appeared in: 1991
Designed by: Guido van Rossum
Developer: Python Software Foundation
Latest release: 2.5.1/ April 18 2007
Latest unstable release: 3.
..... Click the link for more information.
Lisp
Paradigm: multi-paradigm: functional, procedural, reflective
Appeared in: 1958
Designed by: John McCarthy
Developer: Steve Russell, Timothy P. Hart, and Mike Levin
Typing discipline: dynamic, strong
Dialects: Common Lisp, Scheme, Emacs Lisp
..... Click the link for more information.
Basic may be:
..... Click the link for more information.
Keywords are the words that are used to reveal the internal structure of an author's reasoning. While they are used primarily for rhetoric, they are also used in a strictly grammatical sense for structural composition, reasoning, and comprehension.
..... Click the link for more information.
In computer programming, a branch table (sometimes known as a jump table) is a term used to describe an efficient method of transferring program control (branching) to another part of a program using a table of branch instructions.
..... Click the link for more information.
In computer science, lexical analysis is the process of converting a sequence of characters into a sequence of tokens. Programs performing lexical analysis are called lexical analyzers or lexers. A lexer consists of a scanner and a tokenizer.
..... Click the link for more information.
parsing (more formally syntactic analysis) is the process of analyzing a sequence of tokens to determine its grammatical structure with respect to a given formal grammar. A parser is the component of a compiler that carries out this task.
..... Click the link for more information.
In computer science, an abstract syntax tree (AST) is a finite, labeled, directed tree, where the internal nodes are labeled by operators, and the leaf nodes represent the operands of the operators. Thus, the leaves are NULL operators and only represent variables or constants.
..... Click the link for more information.
Emacs Lisp is a dialect of the Lisp programming language used by the GNU Emacs and XEmacs text editors (which will be collectively referred to as Emacs in this article.) It is used for implementing most of the editing functionality built into Emacs, the remainder being written in C.
..... Click the link for more information.
Bytecode is a binary representation of an executable program designed to be executed by a virtual machine rather than by dedicated hardware. Since it is processed by software, it is usually more abstract than machine code.
..... Click the link for more information.
C

The C Programming Language, Brian Kernighan and Dennis Ritchie, the original edition that served for many years as an informal specification of the language.
..... Click the link for more information.
''Virtual Machine Manager redirects here. For the virtual machine monitoring application from Microsoft, see System Center Virtual Machine Manager
In computer science, a virtual machine
..... Click the link for more information.
Forth
Paradigm: Procedural, stack-oriented
Appeared in: 1970s
Designed by: Charles H. Moore
Typing discipline: typeless
Major implementations: Forth, Inc.
..... Click the link for more information.
Open Firmware (also, OpenBoot) is a hardware-independent firmware (computer software which loads the operating system), developed by Mitch Bradley at Sun Microsystems, and used in post-NuBus PowerPC-based Apple Macintosh computers, Sun Microsystems SPARC based workstations
..... Click the link for more information.


In computing, just-in-time compilation (JIT), also known as dynamic translation, is a technique for improving the runtime performance of a computer program.
..... Click the link for more information.
Machine code or machine language is a system of instructions and data directly executed by a computer's central processing unit. Machine code is the lowest-level of abstraction for representing a computer program.
..... Click the link for more information.
.NET Framework is a software component that can be added to or is included with Microsoft Windows operating system. It provides a large body of pre-coded solutions to common program requirements, and manages the execution of programs written specifically for the framework. The .
..... Click the link for more information.
Smalltalk
Paradigm: object-oriented
Appeared in: Development started in 1969
Publicly available in 1980
Designed by: Alan Kay, Dan Ingalls, Adele Goldberg
Developer: Alan Kay, Dan Ingalls, Adele Goldberg, Ted Kaehler, Scott Wallace, and Xerox PARC
..... Click the link for more information.
Literate programming is a philosophy of computer programming based on the premise that a computer program should be written similar to literature, with human readability as a primary goal.
..... Click the link for more information.
Lisp in Small Pieces (Cambridge University Press; New Ed edition (December 4, 2003) ISBN 0521545668)is a book by Christian Queinnec on Lisp, Scheme and other related dialects, their interpretation, semantics, and compilation and contains code for 11 interpreters and 2
..... Click the link for more information.
unit record equipment, electric accounting machines (EAM) or tabulating machines. A data processing shop would have at least one of most of the machine types.
..... Click the link for more information.


This article is copied from an article on Wikipedia.org - the free encyclopedia created and edited by online user community. The text was not checked or edited by anyone on our staff. Although the vast majority of the wikipedia encyclopedia articles provide accurate and timely information please do not assume the accuracy of any particular article. This article is distributed under the terms of GNU Free Documentation License.