Page 67 - 2619_PlusGPT V2.1_C-8
P. 67

LANGUAGE TRANSLATOR


                 When we write programs using high-level languages like Python, Java, or C++ or even using assembly
                 language, these programs need to be understood by the computer. However, the computer doesn't
                 understand these languages directly. It only understands machine language, which consists of binary
                 code (0s and 1s). To make the program understandable to the computer, we need to use a special
                 kind of program called a translator.

                 There are three main types of translators used to convert high-level or assembly language programs
                 into machine language: assemblers, compilers and interpreters.


                      Assembler

                 An assembler is a program used to translate assembly language into machine language so that the
                 computer can understand it. The assembler enables the computer to convert the assembly language
                 instructions into machine code, i.e., 0’s and 1’s.


                      Compiler

                 A compiler is a program that converts the entire source program written in high-level language into

                 machine language before executing it. It converts the entire program into machine language at once.
                 It displays the errors for the whole program together.


                      Interpreter

                 An interpreter is also a separate program that converts the entire source program written in high-
                 level language into machine language before executing it. It translates and executes one statement
                 at a time. It reads a code statement, converts it to one or more machine language instructions and

                 then executes them. It displays the errors one line at a time and it goes to the next line only after the
                 error is corrected.
                 Each of these translators plays a crucial role in making sure that the programs we write in languages
                 that are easier for humans to understand can be translated into a language the computer can process

                 and execute.


                        WORKING OF LANGUAGE TRANSLATORS


                 The programs written in a high-level language or assembly language must be translated into machine
                 language by using a translator called an assembler, compiler and interpreter.


                            3 × 2 = 6                                                      Machine Code (00110)

                                                Input                            Output
                     High-level Language or                    Language                          Machine
                       Assembly Language                      Translator                         Language


                                                                                        Introduction to Programming  65
   62   63   64   65   66   67   68   69   70   71   72