translators by 44Qsr5k

VIEWS: 6 PAGES: 12

									           High-level
           Language


Assembly
Code

Machine
Code
                12
   HIGH         13
                     E.g. PASCAL                   b := a + 100;
  LEVEL          BASIC,
                14       Java, C++, C#,
LANGUAGES   Visual Basic ,Python, LISP, Cobol
                15    0000 0000 1100 1000
                16

                17

                18                                   LDA 15
                19
                20
                     ASSEMBLY                        ADD #100
                21                                   STR 16
   LOW          22
  LEVEL         23
LANGUAGES       24

                25    1001 1011 0000 1111       1001 1011 0000 1111
                MACHINE CODE
                26 1111 1000 0110 0100
                                                1111 1000 0110 0100
                27    0001 0101 0001 0001
                                                0001 0101 0001 0001
               High     4GL
              Level
            Languages   3GL

            Assembly
            Language
                        2GL
Low level
languages               1GL
             Machine
                        1st Generation
              Code
                        Language

             CPU
      openfile “CUSTOMERS”;
      RESULTLIST = ‘’;
      while NOT(EndOfFile) {
             RECORD = CUSTOMERS.PREVIOUS PURCHASES;
             if (RECORD.PREVIOUS PURCHASES > 100){
3GL                 RESULTLIST.ADD(RECORD);
             }
      }
      closefile “CUSTOMERS”;
      return RESULTLIST




      EXTRACT ALL CUSTOMERS WHERE
      "PREVIOUS PURCHASES" TOTAL MORE THAN $1000
4GL
      E.g.: SQL, used for building and maintaining databases
                High-level languages
   General Purpose                           Special Purpose

Pascal                                   COBOL
Educational, commercial and scientific   Common Business Oriented Languages
applications

BASIC                                    Prolog
Beginners All-purpose Symbolic           Logic and Artificial Intelligence (AI)
Instruction Code

C and C++                                SQL
                                         Databases
Used for writing OS software and
applications. Very similar to Assembly


JAVA                                     JavaScript
Object Oriented programming              Web-browser programming
High Level
Language     SYNTAX
Pascal       writeln(‘Hello World!’);
C++          cout << "Hello World!" << endl;
BASIC        PRINT "Hello World!"
JAVA         System.out.println( "Hello World!" );
COBOL                           Hello World!
             DISPLAY "Hello World!"
PROLOG       display('Hello World!') , nl .


SEMANTICS
    High       Interpreter
   Level
 Languages                     Machine
                Compiler        Code


 Assembly
 Language
               Assembler
                              Program is
  Program is                    called
    called                    Object /
Source Code    Translators   Executable
                               Code
ADD #12                 1001 0011 0100 1110

        One-to-one relation


                         1001 0011 0100 1110
                         0101 0101 0111 1101
Readln();                0111 1101 0001 0000
                         0101 1011 1010 1111
                         1111 1101 1011 1100
      One-to-many relation
Source code
(E.g. readln(); )



 Compiler


Object Code
  101101010


      
                  Source code
                   Readln();
                  (E.g. readln(); )

                  Portability
   Interpreter                           Interpreter
 for Platform 1                        for Platform 2




Object Code                           Object Code
 for platform1                         for platform 2
  101101010                             1010111110
Higher level
                       Source code is easier to write and
                      understand (ideal for specific applications like
                      databases, payrolls, logic programming)

                       Portable (given a compiler / interpreter for
   4GL                particular platform)

                       Object code is inefficient
   3GL

   assembly            Difficult to write and correct; source code is long
   machine code  Program is not portable (can only execute
                      on machine for which it was compiled)

                       Object code is more efficient, since
                      hardware can be controlled directly (ideal for
Lower level           device-drivers)

								
To top