World Library  
Flag as Inappropriate
Email this Article

Interpreted language

Article Id: WHEBN0000015089
Reproduction Date:

Title: Interpreted language  
Author: World Heritage Encyclopedia
Language: English
Subject: Compiled language, Ezhil (programming language), Scripting language, Cross-platform, Runtime system
Collection: Programming Language Classification
Publisher: World Heritage Encyclopedia
Publication
Date:
 

Interpreted language

An interpreted language is a programming language for which most of its implementations execute instructions directly, without previously compiling a program into machine-language instructions. The interpreter executes the program directly, translating each statement into a sequence of one or more subroutines already compiled into machine code.

The terms interpreted language and compiled language are not well defined because, in theory, any programming language can be either interpreted or compiled. In modern programming language implementation it is increasingly popular for a platform to provide both options.

Interpreted languages can also be contrasted with machine languages. Functionally, both execution and interpretation mean the same thing — fetching the next instruction/statement from the program and executing it. Although interpreted bytecode is additionally identical to machine code in form and has an assembler representation, the term "interpreted" is practically reserved for "software processed" languages (by virtual machine or emulator) on top of the native (i.e. hardware) processor.

In principle, programs in many languages may be compiled or interpreted, emulated or executed natively, so this designation is applied solely based on common implementation practice, rather than representing an essential property of a language. Akin to processor microcoding, many interpreters internally rely on just-in-time compilation.

Avoiding compilation, interpreted programs are easier to evolve during both development and execution (where they can morph themselves). On the other hand, since compilation implies translation into more machine-friendly format, interpreted programs run more slowly and less efficiently (i.e. waste considerably more energy). This is especially true for higher-level scripting languages, whose statements are complex to analyze compared to machine instruction.

Many languages have been implemented using both compilers and interpreters, including BASIC, C, Lisp, Pascal, and Python. Java and C# are compiled into bytecode, the virtual machine-friendly interpreted language. Lisp implementations can freely mix interpreted and compiled code.

Contents

  • Historical background of interpreted/compiled 1
  • Advantages of interpreting a language 2
  • Disadvantages of interpreted languages 3
  • List of frequently used interpreted languages 4
    • Languages usually compiled to a bytecode 4.1
  • See also 5
  • References 6

Historical background of interpreted/compiled

In the early days of computing, language design was heavily influenced by the decision to use compiling or interpreting as a mode of execution. For example, some compiled languages require that programs must explicitly state the data-type of a variable at the time it is declared or first used while some interpreted languages take advantage of the dynamic aspects of interpreting to make such declarations unnecessary. For example, Smalltalk (1980), which was designed to be interpreted at run-time, allows generic objects to dynamically interact with each other.

Initially, interpreted languages were compiled line-by-line; that is, each line was compiled as it was about to be executed, and if a loop or subroutine caused certain lines to be executed multiple times, they would be recompiled every time. This has become much less common. Most so-called interpreted languages use an intermediate representation, which combines compiling and interpreting. In this case, a compiler may output some form of bytecode or threaded code, which is then executed by a bytecode interpreter.

Examples include:

The intermediate representation can be compiled once and for all (as in Java), each time before execution (as in Perl or Ruby), or each time a change in the source is detected before execution (as in Python).

Advantages of interpreting a language

Interpreting a language gives implementations some additional flexibility over compiled implementations. Features that are often easier to implement in interpreters than in compilers include (but are not limited to):

Disadvantages of interpreted languages

Disadvantages of interpreted languages are:

  • Without static type-checking, which is usually performed by a compiler, programs can be less reliable, because type checking eliminates a class of programming errors.
  • Interpreters can be susceptible to Code injection attacks.
  • Slower execution compared to direct native machine code execution on the host CPU. A technique used to improve performance is just-in-time compilation which converts frequently executed sequences of interpreted instruction to host machine code. JIT is most often combined with compilation to byte-code as in Java.
  • Source code can be read and copied (e.g. JavaScript in web pages), or more easily reverse engineered through reflection in applications where intellectual property has a commercial advantage. In some cases encryption can be used to hide source code, or obfuscation employed to obscure its purpose.

List of frequently used interpreted languages

Languages usually compiled to a bytecode

Many interpreted languages are first compiled to bytecode, which is normally interpreted by virtual machine exploiting some just-in-time compilation of bytecode to native code. However, sometimes, bytecode can also be compiled to a native binary using an AOT compiler or executed natively, by hardware processor.

See also

References

  • Brown,P.J. (1979) Writing Interactive Compilers and Interpreters,John Wiley,ISBN 0-471-27609-X.
This article was sourced from Creative Commons Attribution-ShareAlike License; additional terms may apply. World Heritage Encyclopedia content is assembled from numerous content providers, Open Access Publishing, and in compliance with The Fair Access to Science and Technology Research Act (FASTR), Wikimedia Foundation, Inc., Public Library of Science, The Encyclopedia of Life, Open Book Publishers (OBP), PubMed, U.S. National Library of Medicine, National Center for Biotechnology Information, U.S. National Library of Medicine, National Institutes of Health (NIH), U.S. Department of Health & Human Services, and USA.gov, which sources content from all federal, state, local, tribal, and territorial government publication portals (.gov, .mil, .edu). Funding for USA.gov and content contributors is made possible from the U.S. Congress, E-Government Act of 2002.
 
Crowd sourced content that is contributed to World Heritage Encyclopedia is peer reviewed and edited by our editorial staff to ensure quality scholarly research articles.
 
By using this site, you agree to the Terms of Use and Privacy Policy. World Heritage Encyclopedia™ is a registered trademark of the World Public Library Association, a non-profit organization.
 


Copyright © World Library Foundation. All rights reserved. eBooks from Project Gutenberg are sponsored by the World Library Foundation,
a 501c(4) Member's Support Non-Profit Organization, and is NOT affiliated with any governmental agency or department.