Compiled vs. Interpreted Languages

What is compiler
A compiler is a computer program that transforms source code (programming language/source language) to another computer language (the target language). The most common reason for converting source code is to create an executable program.

The name “compiler” is used for programs that translate source code from a high-level programming language to a lower level language (e.g., assembly language or machine code).

Compiler v/s Interpreter

Compiled language v/s Interpreted language
A compiled language is one where you have to compile the code before it can be executed. The compilation process, for those that don’t know it, transforms the source code into object code; the later can be directly executed by the microprocessor (as it’s formed by opcodes), while the former can’t. So, more generically, a compiled language can be executed, after compilation, without any helper utility. Examples of these include C, C++ and assembler.

An interpreted language is one where you can execute the code without compilation, by means of an interpreter. An interpreter reads the code from the source file and executes it, without converting it to machine code (forget about JIT compilers for now). The way this is done depends on the specific interpreter you are using; but to get an idea, they often construct a parse tree – an in-memory representation of the code structure – from the source file and then evaluate it. Examples of these include Perl, Python, PHP, Basic and POSIX shell scripting.


Difference between Compiler and Interpreter