Page 19 - Computer Class 07
P. 19

8  Interpreter : An interpreter is a computer program, which converts each high-level

                  program  statement  into  the  machine  code.  This  includes  source  code,  pre-
                  compiled code, and scripts. Both compiler and interpreters do the same job which
                  is  converting  high  level  programming  language  to  machine  code.  However,  a

                  compiler will covert the code into machine code before program run. Interpreters
                  convert code into machine code when the program is run.

                  Languages that use interpreter are BASIC, ALGOL 60 and Fortran.


                      High Level
                                                          Interpreter                       Machine Language
                 Language Program




                                                     Get Next Instruction


                                                     Working of an Interpreter

             Differences between a compiler and an interpreter.



                                   Compiler                                           Interpreter


                1.  It scans the entire program first and             1.  Translates the program statement

                     then translates it into machine code.                 by statement.

                2.  Converts  the  entire  program  to                2.  Each  time  the  program  is
                                                                           executed,  every  line  is  checked
                     machine  code;  when  all  the  syntax
                                                                           for  syntax  errors  and  then
                     errors are removed, execution takes
                                                                           converted  to  equivalent  machine
                     place.
                                                                           code.
                3.  Slow for debugging.                               3.  Good for fast debugging.


                4.  Execution time is less.                           4.  Execution time is more.







               8 Computer is a versatile machine.
               8 Computers can be classified into various categories depending on their size, storage

                    capacity, speed and type of experience in personal computing.






                                                                                    Computer-7              19
   14   15   16   17   18   19   20   21   22   23   24