Transcript
Page 1: Compiler vs Interpreter-Compiler design ppt

Welcome to our

Presentation

Topic : COMPILER vs INTERPRETER.

Page 2: Compiler vs Interpreter-Compiler design ppt

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

Page 3: Compiler vs Interpreter-Compiler design ppt

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.

Page 4: Compiler vs Interpreter-Compiler design ppt

Compiler working Process

Page 5: Compiler vs Interpreter-Compiler design ppt

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.

Page 6: Compiler vs Interpreter-Compiler design ppt

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.

Page 7: Compiler vs Interpreter-Compiler design ppt

Interpreter Code Example

Page 8: Compiler vs Interpreter-Compiler design ppt

Interpret Working Process

Page 9: Compiler vs Interpreter-Compiler design ppt

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.

Page 10: Compiler vs Interpreter-Compiler design ppt

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.

Page 11: Compiler vs Interpreter-Compiler design ppt

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).

Page 12: Compiler vs Interpreter-Compiler design ppt

Short Different

Page 13: Compiler vs Interpreter-Compiler design ppt

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.

Page 14: Compiler vs Interpreter-Compiler design ppt

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.

Page 15: Compiler vs Interpreter-Compiler design ppt

That’s all

Any Question

Page 16: Compiler vs Interpreter-Compiler design ppt

Thanks to All for staying with us.


Top Related