Computer Science, asked by vanikuradia148, 11 months ago

Interpreter is a program that translates the program from

Answers

Answered by tejasgupta
1

Hi. An interpreter is a program that checks for bugs in a program line-by-line and not as a whole. During checking, if some errors are found, the execution is stopped and the interpreter asks you to rectify the error. After doing so, it moves to the next line and does the same. If no errors are found in a line, it moves to the next line. After checking the whole program for errors, and if no errors are found, the interpreter runs the program. Hope it helps!


Rajdeep11111: But an interpreter checks line by line....
tejasgupta: Oh..Just a minute.
tejasgupta: Done.
Rajdeep11111: :+1:
tejasgupta: :)
Answered by Rajdeep11111
4

HELLO THERE!

Consider an example first:

Suppose, being an Indian, you know the languages Hindi and English. However, you need to give a speech in Russia where the people don't know the languages you know. There, you need to deliver your speech in Russian language.

For this, you will need to appoint a person to whom both the languages -- Hindi as well as Russian is known. He can translate your speech to Russian, so that the people there gets to know what you are speaking. Now, this translation can be done in two ways:

=> Interpretation: By this method, he translates your sentences to Russian line by line for the people there to understand your speech.

=> Compilation: By this method, he translates your whole speech to Russian, all at once!

In Computing, Computers can only read and understand Machine Code (a code with zeros and ones, 0's and 1's), which we (programmers) don't understand. So, High Level Programming Languages make use of these two softwares (Interpreters andCompilers) to convert user-readable language to Computer-readable language.

Now, consider JAVA as an example:

Java (HLL) makes use of both Interpreter and Compiler.

When you write a program in Java, the code is known as Source Code.

The interpreter converts the source code to Byte Code, which is platform-independent (that can run on any Operating System, be it Windows, or MacOS, or Linux).

However, the program cannot be executed unless it's converted to a platform based code, which is called as the Machine code. The Compiler does this! The compiler converts the Platform independent Byte Code to Machine code, which is separate for different OS, separate for Windows, separate for Linux, separate for Mac...This is indeed a vast concept, without having any ends.

Hope you got your answer, that an interpreter translates the program from Source Code to Byte Code.

THANKS!

Similar questions