Compiler-Interpreter-Compiled and Interpreted Language

Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 3

Compiler and Interpreter are two different ways to translate a program from programming or

scripting language to machine language. 


A compiler takes entire program and converts it into object code which is typically stored in a
file. The object code is also referred as binary code and can be directly executed by the
machine after linking. Examples of compiled programming languages are C and C++. 

An Interpreter directly executes instructions written in a programming or scripting language


without previously converting them to an object code or machine code. Examples of
interpreted languages are Perl, Python and Matlab. 

Following are some interesting facts about interpreters and compilers. 


1) Both compilers and interpreters convert source code (text files) into tokens, both may
generate a parse tree, and both may generate immediate instructions. The basic difference is
that a compiler system, including a (built in or separate) linker, generates a stand alone
machine code program, while an interpreter system instead performs the actions described by
the high level program. 
2) Once a program is compiled, its source code is not useful for running the code. For
interpreted programs, the source code is needed to run the program every time.  
3) In general, interpreted programs run slower than the compiled programs. 

Compiled Language:
A compiled language is a programming language which are generally compiled and not
interpreted. It is one where the program, once compiled, is expressed in the instructions of the
target machine; this machine code is undecipherable by humans. Types of compiled language –
C, C++, C#, CLEO, COBOL, etc.

InterpretedLanguage:
An interpreted language is a programming language which are generally interpreted, without
compiling a program into machine instructions. It is one where the instructions are not directly
executed by the target machine, but instead read and executed by some other program.
Interpreted language ranges – JavaScript, Perl, Python, BASIC, etc.
COMPILED LANGUAGE INTERPRETED LANGUAGE
1 A compiled language is a An interpreted language is a
programming language whose programming language whose
implementations are typically implementations execute instructions
compilers and not interpreters. directly and freely, without
previously compiling a program into
machine-language instructions.
2 In this language, once the program is While in this language, the
compiled it is expressed in the instructions are not directly executed
instructions of the target machine by the target machine.
3 There are at least two steps to get There is only one step to get from
from source code to execution. source code to execution.
4 In this language, compiled programs While in this language, interpreted
run faster than interpreted programs. programs can be modified while the
program is running.
5 In this language, compilation errors In this languages, all the debugging
prevent the code from compiling. occurs at run-time.
6 The code of compiled language can A program written in an interpreted
be executed directly by the language is not compiled, it is
computer’s CPU. interpreted.
7 This language delivers better This languages delivers relatively
performance. slower performance.
8 Example of compiled language – C, Example of Interpreted language –
C++, C#, CLEO, COBOL, etc. JavaScript, Perl, Python, BASIC, etc.

You might also like