Tuesday 8 April 2014

Interpreted VS Compiled Language

So,

We are bogged down by the difference between these words multiple times.

What is interpreted..!!What is compiled..!!

The most important aspect to understand this is that for every program to run on a machine, it is converted to machine code.

The difference between interpreted and compiled lies in the way these are converted to machine code.

In a compiled language: The program after compilation is represented by the instructions understandable by the machine.
A simple example is: the + operator in your code needs to be converted to the ADD operation on machine code.

Interpreted language: the program is not directly run by the machine. It is executed by another program (which acts as a bridge between your code and machine code, and is written in a language understood by the machine.)
A simple example is: the + operation would be recognized by the program (in machine code), which is known as an interpreter at run time, which would call its own ADD method and execute the machine code for the same instruction.

The above reference has been taken by user mikera on stackoverflow. The link is given at the end

User lunaryorn( a user on stackoverflow) has taken this confusion a step further by mentioning the following lines:
A language itself is neither compiled nor interpreted, only a specific implementation of a language is. Java is a perfect example. There is a bytecode-based platform (the JVM), a native compiler (gcj) and an interpeter for a superset of Java (bsh). So what is Java now? Bytecode-compiled, native-compiled or interpreted?
Other languages, which are compiled as well as interpreted, are Scala, Haskell or Ocaml. Each of these languages has an interactive interpreter, as well as a compiler to byte-code or native machine code.
So generally categorizing languages by "compiled" and "interpreted" doesn't make much sense.

Reference: http://stackoverflow.com/questions/3265357/compiled-vs-interpreted-languages