High and Low Level Languages and Their Translators

OLevel

Computer Science 2210

High and Low Level Languages and Their Translators

High and Low Level Languages and Their Translators

High and Low-Level Languages and Their Translators


Program:

• In computer, the specific order of tasks that we ask the computer system to carry out is known as a program.

• It can be defined as the set of instructions to carry out specific tasks.

• It can be written in high-level and low-level languages depending upon the task and the type of computer to be used.

• However, high-level languages are most widely used for writing programs.

High-Level Languages:

• A high-level language is a language that enables a programmer to tell the computer the specific order of task by focusing on the problem itself.

• Using this language, the programmer does not need to know and worry about the instruction set of the computer and the hardware.

• It is portable and can be utilized in various types of computer systems.

• These languages have been developed by keeping the ease of programmers in mind, meaning that:
     
      - These languages are closer to human-understandable languages hence easier to understand.
      - It requires less time and difficulty to write programs as compared to low-level languages.
      - It is easier to debug.
      - It is easier to maintain.
      - These are program-oriented languages.

Examples:
Python
PHP 
ECMAScript 
Ruby 
Delphi 
Java
C#

Low-Level Languages:

• Whereas a low-level language is related to a specific type of computer hardware and architecture.

• It can refer to the binary code that the computer understands, the machine code, or can be written in an assembly language that then translates into the machine code.

Assembly Languages:

• Some programmers prefer to write the program (set of instructions) in assembly language for the following reasons:
   
      - For utilizing special hardware
      - For utilizing specific machine-dependent instructions
      - To save space in primary storage as code is written in assembly language takes less space
      - To write a code that performs task quickly

Example:
• To add two number using assembly languages, the following three statements are required:


 
         
                  Source: (Computer Science by D. Watson & H. Williams

• LDA – It loads the value of the variable in the accumulator
• ADD – It adds the value of another variable to the accumulator with stored value
• STO – It replaces the value in the variable with the stored in the accumulator

Machine Code:

• Machine code is difficult to understand by programmers.

• Therefore, programmers to not write code in machine code generally.

• As it is difficult to manage storage and data manipulation.

• Following is an example of a machine code instruction for adding two numbers in hex and binary:
 

  Source: (Computer Science by D. Watson & H. Williams

Translators:

• Programs are written in languages that are easily understandable by the programmers (humans).

• However, for the computer system to understand and perform the set of instructions given in the programs, the programs need to be translated into machine code or binary instructions.

• It is difficult for humans to work with binary but the computer system only understands it.

• Therefore, a translator is used to translate the programs into binary before the computer can use it.
 

                                 
                           Source: (Computer Science by D. Watson & H. Williams

Types of Translators:

• There are different types of translators available and each performs a different task.

Compilers:

• Compilers are translators that are used to translate HLL (High-Level Languages) into the machine code.

• Once instructions written in HLL are compiled into the machine code; it can be directly used by the computer system again and again without the need for recompilation.

Interpreters:

• It is a type of translator that translates the instructions written in a high-level language (HLL) line by line.

• That is, it reads a statement from the program and translates it and performs the instructions.

• Once done, it moves to the next statement, translates, performs, and so on.

Assemblers:

• It is a type of translator that converts the program written in assembly language into machine code.

• Once the program is converted into machine code, the machine code can be directly used by the computer repeatedly without the need for reassembly.
 

                   Source: (Computer Science by D. Watson & H. Williams


© 2019-2022 O’Level Academy. All Rights Reserved