2009年5月17日 星期日

compiler V.S interpreter

[wikipedia for "Interpreter (computing)"]
http://en.wikipedia.org/wiki/Interpreter_(computer_science)

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

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.

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. 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 and XMLmosaic Interpreter is of type 1.

The intermediate representation can be machine independent code, which is then linked at run-time and executed by an interpreter and/or compiler (for JIT systems). General purpose market languages, such as Smalltalk, Java, and others generally employ JIT.

How about [Compiler (computing)]??