Download as pptx, pdf, or txt
Download as pptx, pdf, or txt
You are on page 1of 11

Presented by : Rohan Fernandes

Compilers and Interpreters

Similarity
The function of a compiler or interpreter is to translate a Higher Level Language (HLL) and execute it.
Compiler or Interpreter

HLL

Output

Major Difference
Timing:Compiled programs generally run faster than interpreted ones because interpreted programs must be reduced to machine instructions at runtime.
Interpreted Read line, translate, execute Repeat Compiled translate into object code link execute

Linking is a complicated process where all the function calls between different modules are hooked together, memory locations are allocated for variables and all the code is laid out in memory, then written to disk as a complete program. This is often a slower step than compiling as all the machine code files must be read into memory and linked together.

Target code
Compilers
HLL Machine language of the executing machine

Interpreters
HLL intermediate code program reads those codes, translates by executing lots of machine language instructions

Binding Times
Compilers
Make decisions as early as possible Results are more efficiently implemented

Interpreters
make decisions late Results less efficient

Java and C#
Both of these languages are semi-compiled. They generate an intermediate code that is optimized for interpretation. This intermediate language is independant of the underlying hardware and this makes it easier to port programs written in either to other processors, so long as an interpreter has been written for that hardware. Java when compiled produces bytecode that is interpreted at runtime by a Java Virtual Machine(JVM).

Conclusion
Both compiled and interpreted languages are good but if we wish to write a very large program then a compiled programming language must be used as it will be faster . Interpreted languages are good to write small applications

For the development of new algorithms it is easier to do all the preliminary testing using an interpreter. Compiled programs meet the user s point of view While interpreted programs provide flexibilty to the programmer

You might also like