Compiler and Interpreter

Compiler and Interpreter:

Need : 

Let's see why we need compiler or interpreter. For example assume that there are three persons A,B,C. Person A knows only English language, Person B knows only Hindi language and Person C knows both English as well as Hindi language. Now, if Person A wants to communicate with Person B then how can they communicate because of language differences. Solution is Person A must first communicate his information to Person C which in turn translate that information in Hindi and then communicate the same to Person B. So it becomes easy for A and  B to communicate with each other using Person C as a mediator.


Compiler and Interpreter does the same task between Computer and Human. Since computer is a machine it knows only machine language or binary language (consists only 0's and 1's). Also we human doesn't know machine language but we know C language. Now to communicate with computer in order to give him instructions we must understand machine language which is difficult. Thus we need Compiler and Interpreter which accepts instructions written in C language (source code) and convert it to machine language (target code) then communicate it with computer. Computer reads target code does processing on it and produces output which displayed to humans on monitor.

If while conversation any error occurs then Compiler and Interpreter generates error messages also.

Definition:
Formally Compiler or Interpreter can be defined as a software which accepts source code program and convert it to a target code so that computer can process it.


Since both of these software's help our programs to run effectively on a computer system they are type of system software.

                                               (See difference)

Comments

Popular posts from this blog

Write a program to allocate memory dynamically for n integers. Accept the elements and calculate their sum and average

C program to accept names of n cities and search for city named “Pune”.