Compiler vs interpreter

ParasPatel47 14,200 views 12 slides Oct 08, 2016
Slide 1
Slide 1 of 12
Slide 1
1
Slide 2
2
Slide 3
3
Slide 4
4
Slide 5
5
Slide 6
6
Slide 7
7
Slide 8
8
Slide 9
9
Slide 10
10
Slide 11
11
Slide 12
12

About This Presentation

What is compiler?Interpreter?Difference between them.


Slide Content

SIGMA INSTITUTE OF ENGINEERING INFORMATION TECHNOLOGY (5 th SEMESTER) SYSTEMPROGRAMMING Guided by:- Mrs. Pragna Makwana Prepared by:- Patel P aras (1405001160 24 ) Patel Pranay (140500116026) Shah Vidhi (140500116036)

What is 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 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 C ode Example

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.

No. COMPILER INTERPRETER 1. Based on language translation linking-loading model. Based on Interpretation Method. 2. Generate a target output program as an output which can be run independently from the source program. Do not generate any output program , they evaluate the source program at each time for execution. 3. Program execution is separate from compilation and performed only after the entire output program is produced. Program Execution is a part of Interpretation and is performed on a statement-by-statement basis. 4. Target program execute independently and does not need the presence of compiler in the memory. The interpreter exist in the memory during interpretation.

No. COMPILER INTERPRETER 5. Do not generate output program , If any is occurred. It can evaluate & execute program statement until an error is found. 6. Need recompilation for generating output program in target language after each modification in the source program. Interpreter is independent of program modification issues as it processes the source program each time during execution. 7. Suitable for Production Environment. Suitable for program development environment. 8. Bounded to specific target machine and cannot be ported. Can be made portable by carefully coding them in a higher level language. 9. C and C++ are example of programming language that use compilation model. Visual Basic , LISP and MATLAB use Interpreter.

Thank you
Tags