Sunday, February 26, 2012

Compilers Basics for IBPS IT Officers Exam


Assume that you visited china to meet China's Prime minister. The meeting was arranged in a big auditorium. But now the problem is, you don't know Chinese and he too don't know your Language (say Hindi). Then what  to Do? Now you have 3 solutions.

  1. To learn Chinese
  2. To make him learn your Language
  3. Or you both should learn some other language (Like English) so that you can communicate in that language...
Now what if HE is not ready to learn your language or English??? and what if you too are Lazy enough to learn Chinese or English??? Isn't there any other solution for this problem???

There is......  If you have enough money, You can hire a person who knows your language as well as Chinese and he will work as a MEDIATOR for both of you people.. :)

Now come to our Subjects...... As we know, computer cant understand our Hais and hellos....
And we too cant understand Computer's 0's and 1's...  So how to talk to the computer and make it works according to your orders?

Can you teach English to computer? Its impossible, because its a machine. It cant understand anything except LOW VOLTAGE (0) and HIGH VOLTAGE (1)... On and Off in simple words...

We too are TALLENTED enough to use CTRL+C and CTRL+V so we are not ready to write big codes which looks like 00011 01001 110100 1001001 01001 11001 11111 0111010 101010 10101011 01111 1101010 11101 1010101  01010 n bla bla........

So what can we do now? we write a Software Code which acts as a TRANSLATOR and converts your instructions into 0's and 1's and gives them to computer and vice versa..  We call this SOFTWARE CODE as COMPILER.. Thats it :)

What exactly is the Compiler? is it a for Translating or for Debugging?
Lets go back to our Chinese Man, assume that you are communicating with him with the help of a Translator. And you have some problem with your TONGUE...  (assume)..... So, what will happn if you use  some adjectives like "Poker face and ######## (censored :P) " .
Now say, what if the Mediator translates that POKER FACE stuff as it is in Chinese???
Your relationship with the Chinese man, will collapsed and you will get some injuries if he is expert in those Chinese martial arts...

So, before going to translate your words in Chinese, your mediator (or Translator) warns you about the outcomes of your words (may be you will get kicked or killed, depends upon the intensity of your words :P) and confirms whether to translate them as they are or not...

Heare also same... Some programmer (like me) writes a program with so many errors. If the compiler translates as it is, the computer may collapse (as it cant hit you for your errors)... So the compiler warns you about your errors so that you can correct them and resubmit your program. So, the main task of the compiler is to TRANSLATE, in-order to translate an Error free program, it warns you about your errors :) 

The Technical Definition : So, technically you can say that "The compiler is a software program which converts the program written in High level language / Programming Language / User Language into the Machine Language / Binary Language to make an Executable Program. 
                                                                                                                           

No comments:

Post a Comment