Difference between Compiler and Interpreter

Difference between Compiler and Interpreter

Do you ever hear about Compiler and Interpreter? These are the programs which translates the high level language into machine language. Let’s know more about these programs.

Compiler

A program that translates high level language program into machine language program is known as compiler. It checks all kinds of limits, ranges, errors etc. But its program execution time is more and occupies a larger part of the memory. It has low speed and low efficiency of memory utilization. If a compiler runs on a computer for which it produces the object code it is known as a self or resident compiler, If a compiler runs on a computer other than that for which it produces object code, it is known as a cross compiler. The compiler derives its name from the way it works, looking at the entire piece of source code and collecting and reorganizing the instructions. Compilers require some time before an executable program emerges. However, programs produced by the compilers run much faster than the same program executed by the interpreter. The object program produced by the compiler is saved for future reference. A compiler is 5-25 times faster than an interpreter because it translates the entire program at once. Examples are C, ForTran etc.


What is Compiler?, What is Interpreter?, Compiler definition, Interpreter definition, Difference between compiler and interpreter.

 

Interpreter

An interpreter is a program which translates one statement of a high level language program into machine code and executes it. In this way it proceeds further till all the statements of the program are translated and executed. An interpreter is the smaller program as compared to the compiler. It needs less memory space. It can be used in a smaller system which with limited memory space. The object program produced by the interpreter Is not saved. If an instruction is used next time, it must be interpreted once again and translated into machine codes. The advantage of interpreter is that it does not need to go through the compilation stage during which machine instructions are generated. This process can be time consuming if the program is long. The interpreters on the other hand, can immediately execute high level programs. For this reason, interpreters are sometime used during the development of a program, when the programmer wants to add small sections at a time and test them quickly. In addition, interpreters are often used in education because they allow students to program interactively. Examples are BASIC and LISP.


Comments

Popular posts from this blog

Linux File System

History of Computers