Welcome to our Presentation Topic : COMPILER vs INTERPRETER.
Jul 12, 2015
Welcome to our
Presentation
Topic : COMPILER vs INTERPRETER.
Group Name: Gravity
Group Member:
Md. Alamgir Hossen Id:121-15-1761Md. Abdus Sami Id:121-15-1712Animesh Bhattacharjee Id:121-15-1680Mushfiqur Rahman Id:121-16-1793
What is Compiler?
Compiler:
A compiler is a piece of code that translates the high level language into machine language. When a user writes a code in a high level language such as Java and wants it to execute, a specific compiler which is designed for Java is used before it will be executed. The compiler scans the entire program first and then translates it into machine code which will be executed by the computer processor and the corresponding tasks will be performed.
Shown in the figure is basic outline of the compilation process, here program written in higher level language is known as source program and the converted one is called object program.
Compiler working Process
Compiler code
Here is a compiler code example
that run “HELLO WORD”
If you create any error in code
then out not found or get error
message.
What is interpreter?
Interpreters:
Interpreters are not much different than compilers. They also convert the high level language into machine readable binary equivalents. Each time when an interpreter gets a high level language code to be executed, it converts the code into an intermediate code before converting it into the machine code. Each part of the code is interpreted and then execute separately in a sequence and an error is found in a part of the code it will stop the interpretation of the code without translating the next set of the codes.
Outlining the basic working of the interpreter the above figure shows that first a source code is converted to an intermediate form and then that is executed by the interpreter.
Interpreter Code Example
Interpret Working Process
COMPILER vs INTERPRETER
A Compiler and Interpreter both carry out the same purpose –convert a high level language (like C, Java) instructions into the binary form which is understandable by computer hardware. They are the software used to execute the high level programs and codes to perform various tasks. Specific compilers/interpreters are designed for different high level languages. However both compiler and interpreter have the same objective but they differ in the way they accomplish their task i.e. convert high level language into machine language. Through this article we will talk about the basic working of both and distinguish the basic difference between compiler and interpreter. Before going through differences, keep in mind the following technical terms.
COMPILER vs INTERPRETER
Compile time: – The time taken to compile a program.
Run time: – The time taken for executing a program.
Source code: - The program in its user written form of the language. Source
code is given as input to the compiler.
Object code: - Is actually the machine code which is obtained by converting
source code. The computer can read and execute machine code directly. An
object code is also known as binary code / machine code.
COMPILER vs INTERPRETER
So the primary difference between a
compiler and interpreter is in the way a
program is executed. Any one serious
about programming should understand
the working of compilers, interpreters and
the differences between them. So here
trying to outline generic differences
between compiling and interpreting
(compilers vs interpreters).
Short Different
Advantages of using compiler
Since compiler converts the program to native code of the target machine
(object code), faster performance can be expected.
There is a scope for code optimization.
Advantages of using interpreter
Process of execution can be done in a single stage. There is no need of a
compilation stage.
Alteration of codes possible during runtime.
Really useful for debugging the codes (because source code execution can
be analyzed in an IDE)
Facilitates interactive code development.
That’s all
Any Question
Thanks to All for staying with us.