Levels of Programming Languages

All computers whether small or big cannot do anything on their own. They all require a series of instructions (i.e programs) before they can do any processing. It is these programs that will direct the computer to carry out the required task. The programs have to be written out comprehensively: to cover all possibilities: and in the right order before the control unit of the CPU can use them effectively.

Programs can be written in several languages. Just as there are many spoken languages, there are many computer languages. In this lecture we shall study the different levels of computer languages and their forms.

Currently all computer languages can be grouped into three, namely, machine languages, assembly languages and high-level languages. Machine languages and assembly languages are together referred to as low-level languages. The detail characteristics of each group of languages are discussed below.

Low-level Languages

These group of languages are so named because in form they are very close (i.e. similar) to the language the computer understands, and very remote from languages spoken by human beings. Low-level languages are in two forms namely: machine language and assembly language.

Machine language

Machine language is as old as the computer itself. It is the computer’s own language. It consists of the code that designates the electrical states in the computer (i.e, on or off): this is expressed as combination of Os and 1s./It is called the computer’s own language because codes or instructions written in machine language can be executed directly by the computer; without the need for any translation. This is the only language that has this characteristic.

Each type of computer has its own machine language. That is to say, that different brands of computers cannot understand programs written in another brand’s machine language. Talking specifically, a computer made by IBM Company has its own language which is different from the one of NCR Company. Even two different models of computers made by the same company do not usually have the same machine language. Thus programs written in machine language are said to be machine dependent.

Every instruction in machine language programs must specify both the operation to be carried out as well as the storage locations of the data items to be used in the operation. In form, it consists of a series of numbers. The operation part is called opcode or operation code and the remaining part gives the addresses of the data items in memory that will be affected by the operation. Due to these special requirements machine language programming is extremely complex, tedious and time consuming.

For example, the instruction, in machine language, to make the computer add together the numbers currently stored in memory address four and seven and then store the sum in address four will look like this.

1A47

The first two numbers 1A is the operation code for add in IBM 360 machine. On another machine it will be another series of numbers different from the one given.

For effective and efficient program in machine language, the programmer must keep track of which memory locations have been used and the purpose of each memory location. Also the programmer must know every operation code and the action that it causes the computer to take. It is quite lengthy and tedious. To overcome this, the assembly language come into existence.

Assembly Language

In order to relieve programmers the arduous task of writing in machine language, the assembly language was developed. It is very much similar to machine language but instead of writing in series of numbers, convenient symbols and abbreviations are used. Assembly language programming does not require the programmer to remember numeric opcodes and addresses. However, it still requires the programmer to be familiar with the operation codes and the methods of addressing memory locations for that particular machine. This is because, the assembly language; though at a higher level, still depend very much on the language of that particular machines.

Programs in assembly language cannot be executed directly, it still has to be changed to the machine language during execution. Thus we can see that assembly language too is machine dependent. That is to say, different brands of computers have different assembly language. For this reason, assembly language is still classified as low-level language.

For the IBM 360 computer the machine language code for ass is 1A while in assembly language, addition operation code is AR is a mnemonic for “Add Register”. For STORE operation the assembly code is the mnemonic STO while TRA stands for TRANSFER Operation and MR stands for MOVE

REGISTER operation etc.

Similarly the programmer can assign a name to each memory location. For instance address seven may be given the name P and address four may be given the name Q, thus the instruction.

AR P. Q

In assembly language will be executed as adding the contents of register Q to the contents of P; of course the final result will be in register P.

As mentioned earlier, regardless of which assembly language is used, the computer cannot directly execute the programs written in this language. It has to be translated into the machine language by another special purpose software called translator. The details of the translation process shall be studied in later lectures.

High-level languages

As computers have developed in complexity, so have programming languages. High-level language programming are the result of sophistication in programming languages.

The Machine and Assembly languages discussed before require programmers to construct programs in a form that does not follow normal ways of human thinking, communication and language notation. To avoid this problem High-level languages were developed. Another name for high-level languages is problem-oriented languages. With this language, programmers’ attention are now directed towards problem solving instead of operations going on inside computer. These languages allow mathematicians and Scientists to use common algebraic notations for coding formulas while other lay programmers can write their programs in ordinary sentence form. The time and effort needed to write programs are now reduced considerably and programs are easier to correct and modify.

A large number of high-level languages are in use today. In fact, more are being developed daily as researchers are still going on.

Example of high-level languages commonly in use today include:

1) BASIC (Beginners All-purpose Symbolic Instruction Code)

2) FORTRAN (Formula Translator). There are many versions of FORTRAN. However the modern version is called FORTRAN 77

3) COBOL (Common Business Oriented Language). There are many versions

4) `C’ language

5) PL/1

6) PASCAL (language named after an ancient French Mathematician and inventor of Pascal engine).

7) Others are: C++, Java, Ruby, Python etc.

Each of the high-level languages has rules that govern how to write instructions in them. Like any human language, it is the duty of the programmer or user to learn the rules of the language he wants to use.

Unlike low-level language which is machine-dependent, high-level languages are machine independent.

That is to say, a program written in any of the high-level languages can be run with little or no changes by computer made by many different manufacturers. Thus, as new computers come into existence, programmers do not have to rewrite the existing programs and learn new language as it is the case with assembly programming.

The example below shows how to add two numbers held in variables X and Y placing the sum in X using the most common four high-level languages.

Lesson tags: Programming
Back to: Introduction to Programming