Share on Facebook Share on Twitter Email
Answers.com

interpreter

 
Dictionary: in·ter·pret·er   (ĭn-tûr'prĭ-tər) pronunciation
n.
  1. One who translates orally from one language into another.
  2. One who gives or expounds an interpretation: "An actor is an interpreter of other men's words, often a soul which wishes to reveal itself to the world" (Alec Guinness).
  3. Computer Science. A program that translates an instruction into a machine language and executes it before proceeding to the next instruction.

Search unanswered questions...
Enter a question here...
Search: All sources Community Q&A Reference topics

A high-level programming language translator that translates and runs the program at the same time. It converts one program statement into machine language, executes it, and then proceeds to the next statement. This differs from regular executable programs that are presented to the computer as binary-coded instructions. Interpreted programs remain in the source language the programmer wrote in, which is human readable text.

Slower, But Easier to Test

Interpreted programs run slower than their compiler counterparts. Whereas the compiler translates the entire program before it is run, interpreters translate a line at a time while the program is being run. However, it is very convenient to write an interpreted program, since a single line of code can be tested interactively.

Some languages can be both interpreted and compiled, in which case a program may be developed with the interpreter for ease of testing and debugging and later compiled for production use. See JIT compiler.

The Runtime Interpreter Must Be Present

Interpreted programs must always be run with the interpreter, commonly called a runtime module. For example, in order to run a BASIC or Foxbase program, the BASIC or Foxbase interpreter must be running as well.

Interpreted Vs. Intermediate Languages

Interpreted languages also differ from intermediate languages such as Java, which are partially converted but still require a runtime module (see Java and Java virtual machine).

Interpreters and Compilers
Unlike compiled languages which are translated into machine language ahead of time (right), interpreted languages are translated at runtime. dBASE and BASIC interpreters (middle) translate the original source code. Java and Visual Basic (left) interpreters translate "bytecode," which is an intermediate language compiled from the original source code.

Download Computer Desktop Encyclopedia to your iPhone/iTouch

Business Dictionary: Interpreter
Top

In general: person who translates orally foreign languages for people using different languages.

Computers: program that executes a source program by reading it one line at a time and doing the specified operations immediately. Most Basic systems are interpreters. See also Compiler.

Devil's Dictionary: interpreter
Top
A cynical view of the world by Ambrose Bierce


n.

One who enables two persons of different languages to understand each other by repeating to each what it would have been to the interpreter's advantage for the other to have said.


Wikipedia: Interpreter (computing)
Top

In computer science, an interpreter normally means a computer program that executes, i.e. performs, instructions written in a programming language. An interpreter may be a program that either

  1. executes the source code directly
  2. translates source code into some efficient intermediate representation (code) and immediately executes this
  3. explicitly executes stored precompiled code[1] made by a compiler which is part of the interpreter system

Perl, Python, MATLAB, and Ruby are examples of type 2, while UCSD Pascal and Java are type 3: Source programs are compiled ahead of time and stored as machine independent code, which is then linked at run-time and executed by an interpreter and/or compiler (for JIT systems). Some systems, such as Smalltalk, and others, may also combine 2 and 3.

While interpretation and compilation are the two principal means by which programming languages are implemented, these are not fully distinct categories, one of the reasons being that most interpreting systems also perform some translation work, just like compilers. The terms interpreted language or compiled language merely mean that the canonical implementation of that language is an interpreter or a compiler; a high level language is basically an abstraction which is (ideally) independent of particular implementations.

Contents

Bytecode interpreters

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.

Efficiency

The main disadvantage of interpreters is that when a program is interpreted, it typically runs more slowly 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 within a fixed context determined by the compilation. 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.

Abstract Syntax Tree interpreters

In the spectrum between interpreting and compiling, another approach is transforming the source code into an optimized Abstract Syntax Tree (AST), and then proceeding to execute the program following this tree structure. [2] In this approach each sentence needs to be parsed just once. As an advantage over bytecode, the AST keeps the global program structure and relations between statements (which is lost in a bytecode representation), and provides a more compact representation.[3]

Thus, AST has been proposed as a better intermediate format for Just-in-time compilers than bytecode. Also, it allows to perform better analysis during runtime. An AST-based Java interpreter has been proved to be faster than a similar bytecode-based interpreter,[4] thanks to the more powerful optimizations allowed by having the complete structure of the program, as well as higher level typing, available during execution.

Just-in-time compilation

Further blurring the distinction between interpreters, byte-code interpreters and compilation is just-in-time compilation (or JIT), a technique in which the intermediate representation is compiled to native machine code at runtime. This confers the efficiency of running native code, at the cost of startup time and increased memory use when the bytecode or AST is first compiled. Adaptive optimization is a complementary technique in which the interpreter profiles the running program and compiles its most frequently-executed parts into native code. Both techniques are a few decades old, appearing in languages such as Smalltalk in the 1980s.

Just-in-time compilation has gained mainstream attention amongst language implementors in recent years, with Java, Python and the .NET Framework all now including JITs.

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 on the card. The IBM 550 Numeric Interpreter and IBM 557 Alphabetic Interpreter are typical examples from 1930 and 1954, respectively.

See also

Notes and references

  1. ^ In this sense, the CPU is also an interpreter, of machine instructions.
  2. ^ AST intermediate representations, Lambda the Ultimate forum
  3. ^ A Tree-Based Alternative to Java Byte-Codes, Thomas Kistler, Michael Franz
  4. ^ Trees Versus Bytes, BComp Honours thesis by Kade Hansson

External links

  • DrPubaGump A tiny Interpreter written in Scheme, which provides to interpret PUBA-GUMP (a subset of BASIC) in Scheme
  • IBM Card Interpreters page at Columbia University

This article was originally based on material from the Free On-line Dictionary of Computing, which is licensed under the GFDL.


Translations: Interpreter
Top

Dansk (Danish)
n. - oversætter, tolk, fortolker

Nederlands (Dutch)
tolk, vertolker

Français (French)
n. - interprète, (Comput) traductrice, interpréteur (un programme)

Deutsch (German)
n. - Interpret, Dolmetscher

Ελληνική (Greek)
n. - διερμηνέας, (Η/Υ) διερμηνευτής, λογισμικό μετάφρασης

Italiano (Italian)
interprete

Português (Portuguese)
n. - intérprete (m) (f)

Русский (Russian)
устный переводчик, интерпретатор

Español (Spanish)
n. - intérprete, actor, traductor

Svenska (Swedish)
n. - tolk, återgivare, framställare

中文(简体)(Chinese (Simplified))
直译程序, 翻译员, 解释者

中文(繁體)(Chinese (Traditional))
n. - 直譯程式, 翻譯員, 解釋者

한국어 (Korean)
n. - 해석자, 통역자, 연출자

日本語 (Japanese)
n. - 解釈者, 説明者, 通訳者, 通訳, 解説者

العربيه (Arabic)
‏(الاسم) المترجم ( بين متحدثين بلغتين مختلفتين)‏

עברית (Hebrew)
n. - ‮פרשן, מתורגמן - מתרגם בע"פ, תוכנית מחשב המבצעת תוכנית שורה-שורה‬


 
 

 

Copyrights:

Dictionary. The American Heritage® Dictionary of the English Language, Fourth Edition Copyright © 2007, 2000 by Houghton Mifflin Company. Updated in 2009. Published by Houghton Mifflin Company. All rights reserved.  Read more
Computer Desktop Encyclopedia. THIS COPYRIGHTED DEFINITION IS FOR PERSONAL USE ONLY.
All other reproduction is strictly prohibited without permission from the publisher.
© 1981-2009 Computer Language Company Inc.  All rights reserved.  Read more
Business Dictionary. Dictionary of Business Terms. Copyright © 2000 by Barron's Educational Series, Inc. All rights reserved.  Read more
Devil's Dictionary. Devil's Dictionary by Ambrose Bierce, 1911  Read more
Wikipedia. This article is licensed under the Creative Commons Attribution/Share-Alike License. It uses material from the Wikipedia article "Interpreter (computing)" Read more
Translations. Copyright © 2007, WizCom Technologies Ltd. All rights reserved.  Read more