Interpreter (computing) Photos:

Interpreter (computing)
Photo:1
Interpreter (computing)
Photo:2
Interpreter (computing)
Photo:3
Interpreter (computing)
Photo:4


Interpreter (computing) Basic Informations:

History
2> The first interpreted high-level language was probably Lisp. Lisp was first implemented by Steve Russell on an IBM 704 computer. Russell had read McCarthy's paper, and realized (to McCarthy's surprise) that the Lisp eval function could be implemented in machine code.[2] The result was a working Lisp interpreter which could be used to run Lisp programs, or more properly, 'evaluate Lisp expressions.' [edit]

Tags:Perl,Lisp,Steve Russell,Ibm 704,C,Machine Code,
Advantages and disadvantages of using interpreters
2> Programmers usually write programs in high level code, which the CPU cannot execute; so this source code has to be converted into machine code. This conversion is done by a compiler or an interpreter. A compiler makes the conversion just once, while an interpreter typically converts it every time a program is executed (or in some languages like early versions of BASIC, every time a single instruction is executed). [edit]

Tags:Source Code,Compiler,Basic,High Level,Cpu,
Development cycle
3> During program development, the programmer makes frequent changes to source code. With a compiler, each time the programmer makes a change to the source code, s/he must wait for the compiler to make a compilation of the altered source files, and link all of the binary code files together before the program can be executed. The larger the program, the longer the programmer must wait to see the results of the change. By contrast, a programmer using an interpreter does a lot less waiting, as the interpreter usually just needs to translate the code being worked on to an intermediate representation (or not translate it at all), thus requiring much less time before the changes can be tested. [edit]

Tags:Intermediate Representation,Link,
Distribution
3> A compiler converts source code into binary instruction for a specific processor's architecture, thus making it less portable. This conversion is made just once, on the developer's environment, and after that the same binary can be distributed to the user's machines where it can be executed without further translation. A cross compiler can generate binary code for the user machine even if it has a different processor than the machine where the code is compiled. An interpreted program can be distributed as source code. It needs to be translated in each final machine, which takes more time but makes the program distribution independent of the machine's architecture. However, the portability of interpreted source code is dependent on the target machine actually having a suitable interpreter. If the interpreter needs to be supplied along with the source, the overall installation process is more complex than delivery of a monolithic executable. The fact that interpreted code can easily be read and copied by humans can be of concern from the point of view of copyright. However, various systems of encryption and obfuscation exist. Delivery of intermediate code, such as bytecode, has a similar effect to obfuscation. [edit]

Tags:Cross Compiler,Copyright,Encryption,Obfuscation,Bytecode,
Efficiency
3> 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 (such as 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. Many BASIC interpreters replace keywords with single byte tokens which can be used to find the instruction in a jump table. Others achieve even higher levels of program compaction by using a bit-oriented rather than a byte-oriented program memory structure, where commands tokens can occupy perhaps 5 bits of a 16 bit word, leaving 11 bits for their label or address operands. An interpreter might well use the same lexical analyzer and parser as the compiler and then interpret the resulting abstract syntax tree. [edit]

Tags:Lisps,Keywords,Jump Table,Lexical Analyzer,Parser,Abstract Syntax Tree,Bug,
Regress
3> Interpretation cannot be used as the sole method of execution: even though an interpreter can itself be interpreted, a directly executed programme is needed somewhere at the bottom of the stack. [edit]

Tags:
Bytecode interpreters
3> Main article: Bytecode 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. Control tables - that do not necessarily ever need to pass through a compiling phase - dictate appropriate algorithmic control flow via customized interpreters in similar fashion to bytecode interpreters. [edit]

Tags:Compiling,Emacs Lisp,Virtual Machine,Forth,Open Firmware,Control Tables,Control Flow,
Abstract Syntax Tree interpreters
3> In the spectrum between interpreting and compiling, another approach is transforming the source code into an optimized Abstract Syntax Tree (AST) then executing the program following this tree structure, or using it to generate native code Just-In-Time.[3] 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 when compressed provides a more compact representation.[4] Thus, using 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. However, for interpreters, an AST causes more overhead than a bytecode interpreter, because of nodes related to syntax performing no useful work, of a less sequential representation (requiring traversal of more pointers) and of overhead visiting the tree.[5] [edit]

Tags:
Just-in-time compilation
3> 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.[6] Just-in-time compilation has gained mainstream attention amongst language implementers in recent years, with Java, the .NET Framework and most modern JavaScript implementations now including JITs. [edit]

Tags:Jit,Smalltalk,Java,Just-in-time Compilation,Adaptive Optimization,.net Framework,Javascript,
Applications
2> Interpreters are frequently used to execute command languages, and glue languages since each operator executed in command language is usually an invocation of a complex routine such as an editor or compiler. Self-modifying code can easily be implemented in an interpreted language. This relates to the origins of interpretation in Lisp and artificial intelligence research. Virtualisation. Machine code intended for one hardware architecture can be run on another using a virtual machine, which is essentially an interpreter. Sandboxing: An interpreter or virtual machine is not compelled to actually execute all the instructions the source code it is processing. In particular, it can refuse to execute code that violates any security constraints it is operating under. [edit]

Tags:Interpreted Language,Command Languages,Glue Languages,Self-modifying Code,Artificial Intelligence,Virtualisation,Sandboxing,Security,
Punched card interpreter
2> 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. [edit]

Tags:Unit Record Equipment,Punched Cards,Ibm 550,Ibm 557,
See also
2> Command-line interpreter Interpreted language Compiled language Dynamic compilation Partial evaluation Meta-circular evaluator [edit]

Tags:Compiled Language,Command-line Interpreter,Dynamic Compilation,Partial Evaluation,Meta-circular Evaluator,
Notes and references
2> ^ In this sense, the CPU is also an interpreter, of machine instructions. ^ According to what reported by Paul Graham in Hackers & Painters, p. 185, McCarthy said: "Steve Russell said, look, why don't I program this eval..., and I said to him, ho, ho, you're confusing theory with practice, this eval is intended for reading, not for computing. But he went ahead and did it. That is, he compiled the eval in my paper into IBM 704 machine code, fixing bug, and then advertised this as a Lisp interpreter, which it certainly was. So at that point Lisp had essentially the form that it has today..." ^ AST intermediate representations, Lambda the Ultimate forum ^ A Tree-Based Alternative to Java Byte-Codes, Thomas Kistler, Michael Franz ^ http://webkit.org/blog/189/announcing-squirrelfish/ ^ L. Deutsch, A. Schiffman, Efficient implementation of the Smalltalk-80 system, Proceedings of 11th POPL symposium, 1984. [edit]

Tags:Paul Graham,Hackers & Painters,
External links
2> IBM Card Interpreters page at Columbia University Theoretical Foundations For Practical 'Totally Functional Programming' (Chapter 7 especially) Doctoral dissertation tackling the problem of formalising what is an interpreter This article was originally based on material from the Free On-line Dictionary of Computing, which is licensed under the GFDL. Retrieved from "http://en.wikipedia.org/w/index.php?title=Interpreter_(computing)&oldid=471431504" Categories: Interpreters (computing)Programming language implementationHidden categories: Wikipedia articles incorporating text from FOLDOC Personal tools Log in / create account Namespaces Article Talk Variants Views Read Edit View history Actions Search Navigation Main page Contents Featured content Current events Random article Donate to Wikipedia Interaction Help About Wikipedia Community portal Recent changes Contact Wikipedia Toolbox What links here Related changes Upload file Special pages Permanent link Cite this page Print/export Create a bookDownload as PDFPrintable version Languages العربية Azərbaycanca Bosanski Català Česky Dansk Deutsch Eesti Ελληνικά Español Euskara فارسی Français 한국어 Hrvatski Bahasa Indonesia Íslenska Italiano עברית Lietuvių Magyar Bahasa Melayu Nederlands 日本語 Polski Português Română Русский Simple English Slovenčina Slovenščina Српски / Srpski Suomi Svenska ไทย Türkçe Українська Tiếng Việt 中文 This page was last modified on 15 January 2012 at 03:09. Text is available under the Creative Commons Attribution-ShareAlike License; additional terms may apply. See Terms of use for details. Wikipedia® is a registered trademark of the Wikimedia Foundation, Inc., a non-profit organization.Contact us Privacy policy About Wikipedia Disclaimers Mobile view if ( window.isMSIE55 ) fixalpha(); if ( window.mediaWiki ) { mw.loader.load(["mediawiki.user", "mediawiki.util", "mediawiki.page.ready", "mediawiki.legacy.wikibits", "mediawiki.legacy.ajax", "mediawiki.legacy.mwsuggest", "ext.gadget.wmfFR2011Style", "ext.vector.collapsibleNav", "ext.vector.collapsibleTabs", "ext.vector.editWarning", "ext.vector.simpleSearch", "ext.UserBuckets", "ext.articleFeedback.startup", "ext.articleFeedbackv5.startup", "ext.markAsHelpful"]); } if ( window.mediaWiki ) { mw.user.options.set({"ccmeonemails":0,"cols":80,"date":"default","diffonly":0,"disablemail":0,"disablesuggest":0,"editfont":"default","editondblclick":0,"editsection":1,"editsectiononrightclick":0,"enotifminoredits":0,"enotifrevealaddr":0,"enotifusertalkpages":1,"enotifwatchlistpages":0,"extendwatchlist":0,"externaldiff":0,"externaleditor":0,"fancysig":0,"forceeditsummary":0,"gender":"unknown","hideminor":0,"hidepatrolled":0,"highlightbroken":1,"imagesize":2,"justify":0,"math":1,"minordefault":0,"newpageshidepatrolled":0,"nocache":0,"noconvertlink":0,"norollbackdiff":0,"numberheadings":0,"previewonfirst":0,"previewontop":1,"quickbar":5,"rcdays":7,"rclimit":50,"rememberpassword":0,"rows":25,"searchlimit":20,"showhiddencats":false,"showjumplinks":1,"shownumberswatching":1,"showtoc":1,"showtoolbar":1,"skin":"vector","stubthreshold":0,"thumbsize":4,"underline":2,"uselivepreview":0,"usenewrc":0,"watchcreations":1,"watchdefault":0,"watchdeletion":0,"watchlistdays":3,"watchlisthideanons":0, "watchlisthidebots":0,"watchlisthideliu":0,"watchlisthideminor":0,"watchlisthideown":0,"watchlisthidepatrolled":0,"watchmoves":0,"wllimit":250,"flaggedrevssimpleui":1,"flaggedrevsstable":0,"flaggedrevseditdiffs":true,"flaggedrevsviewdiffs":false,"vector-simplesearch":1,"useeditwarning":1,"vector-collapsiblenav":1,"usebetatoolbar":1,"usebetatoolbar-cgd":1,"wikilove-enabled":1,"variant":"en","language":"en","searchNs0":true,"searchNs1":false,"searchNs2":false,"searchNs3":false,"searchNs4":false,"searchNs5":false,"searchNs6":false,"searchNs7":false,"searchNs8":false,"searchNs9":false,"searchNs10":false,"searchNs11":false,"searchNs12":false,"searchNs13":false,"searchNs14":false,"searchNs15":false,"searchNs100":false,"searchNs101":false,"searchNs108":false,"searchNs109":false,"gadget-wmfFR2011Style":1});;mw.user.tokens.set({"editToken":"+\\","watchToken":false});;mw.loader.state({"user.options":"ready","user.tokens":"ready"}); /* cache key: enwiki:resourceloader:filter:minify-js:4:b41a86ec4e0fe8329bc3ce917e792339 */ }

Tags:Programming Language,Free On-line Dictionary Of Computing,Licensed,Gfdl,


zote monety