Compiler vs Interpreter-Compiler design ppt

  • View

  • Download

Embed Size (px)

Text of Compiler vs Interpreter-Compiler design ppt

Welcome to our Presentation

Welcome to our PresentationTopic : 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-1793What is Compiler?Compiler:Acompiler 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 WORDIf 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


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 basicdifference between compiler and interpreter. Before going through differences, keep in mindthe followingtechnical terms.COMPILER vs INTERPRETERCompile 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 INTERPRETERSo 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 compilerSince 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 interpreterProcess 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.Thats allAny Question

Thanks to All for staying with us.