Q. How does the computer understand a program written in high level language?


Answer:-

The program code written in assembly or high-level language is called source code. The source code is converted by a translator into the machine understandable form called object (machine) code.
As we have different types of computer languages, different translators are needed to convert the source code to machine code. The three types of translators used in computing systems are assembler, compiler and interpreter.
The translator used to convert the code written in assembly language to machine language is called assembler. Each assembler can understand a specific microprocessor instruction set only and hence, the machine code is not portable.
We also need translators to convert codes written in high level language (source code) to machine understandable form (machine code) for execution by the computer. Compiler converts the source code into machine code. If the code follows all syntactic rules of the language, then it is executed by the computer. Once translated, the compiler is not needed.
An interpreter translates one line at a time instead of the whole program at one go. Interpreter takes one line, converts it into executable code if the line is syntactically correct, and then it repeats these steps for all lines in the source code. Hence, interpreter is always needed whenever a source code is to be executed.

Conclusion:-
Code in high level language (Source Code) -> Language translator -> Code in machine language (Object Code)

Post a Comment

You can help us by Clicking on ads. ^_^
Please do not send spam comment : )

Previous Post Next Post