Now
you wrote some steps, but what happens next! How do you get the output
and how would your computer understand what you wrote. There has to be a
mechanism by which the computer understand the program and returns the
desired result. This is done by another program called the
compiler/interpreter. They take your code, break them down to bits and
bytes, go through your steps, calculate the result and give the output.
Compiler/Interpreter are themselves programs. They are written by the
specific vendors - example C, C++, Matlab, BASIC, and Java. You never
get access these and do not have worry about how they are written. They
are in the background - acting as an inter mediator between your code
and the computer.
To understand better, let’s take the example of a calculator. Have you ever wondered how it works? You say 10+5, and press Enter and you see 15 on the screen. Every calculator has a small micro controller chip with a 'program' in it. This program is similar to a compiler/interpreter in our context. The calculator chip is your hardware, and your maths (10 + 5) is your code. The micro controller program understands 10 and 5, converts to bits, performs the operation '+' and then returns 15.
In the first para, I was mentioning that each language has its own compilers/interpreters and syntax, but why? Because, they are developed by different vendors for different purposes. Sometimes or probably most of the times, you will be able to solve the same problem in different languages. But you pick a language because it has a unique feature or probably it suits your type of work, cost, platform [ Windows, Unix etc]. The vendor who designed the programming language decides on its syntax. That is why you would see some languages doing basic functions and very simple like writing in English and some others a little more complicated.
To understand better, let’s take the example of a calculator. Have you ever wondered how it works? You say 10+5, and press Enter and you see 15 on the screen. Every calculator has a small micro controller chip with a 'program' in it. This program is similar to a compiler/interpreter in our context. The calculator chip is your hardware, and your maths (10 + 5) is your code. The micro controller program understands 10 and 5, converts to bits, performs the operation '+' and then returns 15.
In the first para, I was mentioning that each language has its own compilers/interpreters and syntax, but why? Because, they are developed by different vendors for different purposes. Sometimes or probably most of the times, you will be able to solve the same problem in different languages. But you pick a language because it has a unique feature or probably it suits your type of work, cost, platform [ Windows, Unix etc]. The vendor who designed the programming language decides on its syntax. That is why you would see some languages doing basic functions and very simple like writing in English and some others a little more complicated.
I
have used Compiler/Interpreter through out and it would be unfair if I
leave this topic without explaining what they are. On a high level, a
Compiler would read and convert the entire program into a machine
language. But an interpreter, will read one line/set of related line,
and execute that first. Then read the second set of lines, execute and
related it to the first executed code. By execute I mean, come to a
conclusion of a calculation. An Interpreter is generally slow.
No comments:
Post a Comment