Monday, July 21, 2008

Compiler vs Interpreter

What is Compiler and Interpreter?

Dad: Johny! Why you are so dull today?
Johny: In my computer exam, there was a question. I was not able to answer it.
Dad: What was the Question?
Johny: "What is the difference between Compiler and Interpreter."

Remember these points:

1) Both are programs

2)Both are used for translating source code into machine code(or object code)

In other words,

Both are used for translating from High Level Language into Low Level Language.

3) Interpreter translates ONLY ONE STATEMENT AT A TIME

in other words,

Interpreter translates LINE BY LINE

4)But Compiler translates in ONE STRETCH.

5. For fast opertion, Compiler is prefered.

6. For interactive operations, Interpreter is prefered.


Johny, can you remember, we attened a christian meeting last month. One foreigner was giving a speech. One local person was translating his speech.

Yes,Dad, The foreiner was telling just four words " Once upon a time." . Immediately our local man translated it into our local language.

Now, tell me, whether he was INTERPRETING or COMPILING his speech ?

He was interpreting only. Because , he was translating every line and disposing it then and there. Compilation means, he should completely observe the foreigner speech fully and finally he has to deliver the output in one go.

Very good. Interpreter and compiler work in the same way. Again read the six points given above and you will never forget the answer.








No comments:

Disclaimer and Copyright