Sei sulla pagina 1di 1

What is the difference between compiled and interpreted programming languages?

Post Jesse Tov, likes programming languages.


12 votes by Michael Genkin, Alistair Atkinson, Justin Sheehy, (more)

There is no difference, because compiled programming language and interpreted programming language arent meaningful concepts. Any programming language, and I really mean any, can be interpreted or compiled. Thus, interpretation and compilation are implementation techniques, not attributes of languages. Interpretation is a technique whereby another program, the interpreter, performs operations on behalf of the program being interpreted in order to run it. If you can imagine reading a program and doing what it says to do step-by-step, say on a piece of scratch paper, thats just what an interpreter does as well. A common reason to interpret a program is that interpreters are relatively easy to write. Another reason is that an interpreter can monitor what a program tries to do as it runs, to enforce a policy, say, for security. Compilation is a technique whereby a program written in one language (the source language) is translated into a program in another language (the object language), which hopefully means the same thing as the original program. While doing the translation, it is common for the compiler to also try to transform the program in ways that will make the object program faster (without changing its meaning!). A common reason to compile a program is that theres some good way to run programs in the object language quickly and without the overhead of interpreting the source language along the way. You may have guessed, based on the above definitions, that these two implementation techniques are not mutually exclusive, and may even be complementary. Traditionally, the object language of a compiler was machine code or something similar, which refers to any number of programming languages understood by particular computer CPUs. The machine code would then run on the metal (though one might see, if one looks closely enough, that the metal works a lot like an interpreter). Today, however, its very common to use a compiler to generate object code that is meant to be interpretedfor example, this is how Java used to (and sometimes still does) work. We also have interpreters for machine code, which can be used to emulate one kind of hardware on another. Or, one might use a compiler to generate object code that is then the source code for another compiler, which might even compile code in memory just in time for it to run, which in turn . . . you get the idea. There are many ways to combine these concepts.

Reference: http://www.quora.com/What-is-the-difference-between-compiled-and-interpretedprogramming-languages

Potrebbero piacerti anche