Programming language implementation
Encyclopedia
A programming language implementation is a system for executing programs written in a programming language
Programming language
A programming language is an artificial language designed to communicate instructions to a machine, particularly a computer. Programming languages can be used to create programs that control the behavior of a machine and/or to express algorithms precisely....

.

There are two general approaches to programming language implementation:
  • Interpretation: An interpreter
    Interpreter (computing)
    In computer science, an interpreter normally means a computer program that executes, i.e. performs, instructions written in a programming language...

     takes as input a program in some language, and performs the actions written in that language on some machine.
  • Compilation: A compiler
    Compiler
    A compiler is a computer program that transforms source code written in a programming language into another computer language...

     takes as input a program in some language, and translates that program into some other language, which may serve as input to another interpreter or another compiler.


Notice that a compiler does not directly execute the program. Ultimately, in order to execute a program via compilation, it must be translated into a form that can serve as input to an interpreter.

When a piece of computer hardware can interpret a programming language directly, that language is called machine code. A so-called native code compiler is one that compiles a program into machine code. Actual compilation is often separated into multiple passes, like code generation (often for assembler language), assembling (generating native code), linking, loading and execution.

If a compiler of a given high level language produces another high level language it is called translator (source to source translation), which is often useful to add extensions to existing languages or to exploit good and portable
Software portability
Portability in high-level computer programming is the usability of the same software in different environments. The prerequirement for portability is the generalized abstraction between the application logic and system interfaces...

 implementation of other language (for example C), simplifying development.

Many combinations of interpretation and compilation are possible, and many modern programming language implementations include elements of both. For example, the Smalltalk
Smalltalk
Smalltalk is an object-oriented, dynamically typed, reflective programming language. Smalltalk was created as the language to underpin the "new world" of computing exemplified by "human–computer symbiosis." It was designed and created in part for educational use, more so for constructionist...

 programming language is conventionally implemented by compilation into bytecode
Bytecode
Bytecode, also known as p-code , is a term which has been used to denote various forms of instruction sets designed for efficient execution by a software interpreter as well as being suitable for further compilation into machine code...

, which is then either interpreted or compiled by a virtual machine
Virtual machine
A virtual machine is a "completely isolated guest operating system installation within a normal host operating system". Modern virtual machines are implemented with either software emulation or hardware virtualization or both together.-VM Definitions:A virtual machine is a software...

 (most popular ways is to use JIT
Just-in-time compilation
In computing, just-in-time compilation , also known as dynamic translation, is a method to improve the runtime performance of computer programs. Historically, computer programs had two modes of runtime operation, either interpreted or static compilation...

 or AOT compiler
AOT compiler
An ahead-of-time compiler is a compiler that implements ahead-of-time compilation. This refers to the act of compiling an intermediate language, such as Java bytecode, .NET Common Intermediate Language , or IBM System/38 or IBM System i "Technology Independent Machine Interface" code, into a...

 compilation). This implementation strategy has been copied by many languages since Smalltalk pioneered it in the 1970s and 1980s.

See also

  • Compiler construction
    Compiler construction
    Compiler construction is an area of computer science that deals with the theory and practice of developing programming languages and their associated compilers....

  • Functional compiler
    Functional compiler
    A functional compiler is a compiler for a functional programming language. Functional compilers perform such transformation on source code which transform it to continuation-passing style or administrative normal form and need to handle tail calls correctly....

The source of this article is wikipedia, the free encyclopedia.  The text of this article is licensed under the GFDL.
 
x
OK