Levels of programming languages
LEVELS OF PROGRAMMING LANGUAGES
There are many programming languages. The languages are classified into 2 major categories:
These are the basic programming languages, which can easily be understood by the computer directly, or which require little effort to be translated into computer understandable form.
Features of low-level languages
Machine languages (1st Generation languages)
Machine language is written using machine codes (binary digits) that consist of 0’s & 1’s.
The computer can readily understand Machine code (language) instructions without any translation.
A programmer is required to write his program in strings of 0’s & 1’s, calculate & allocate the core memory locations for his data and/or instructions.
Different CPU’s have different machine codes, e.g., codes written for the Intel Pentium processors may differ from those written for Motorola or Cyrix processors. Therefore, before interpreting the meaning of a particular code, a programmer must know for which CPU the program was written.
A machine code instruction is made up of 2 main parts;
Note. The computer can only execute instructions which are written in machine language. This is because; it is the only language which the computer can understand. Therefore, any program written in any other programming language must first be translated into machine language (binary digits) before the computer can understand.
Assembly language (2nd Generation Languages).
Assembly languages were developed in order to speed up programming (i.e., to overcome the difficulties of understanding and using machine languages).
The vocabulary of Assembly languages is close to that of machine language, and their instructions are symbolic representations of the machine language instructions.
To write program statements in Assembly language, the programmer uses a set of symbolic operation codes called Mnemonic codes.
The code could be a 2 or 3 shortened letter word that will cause the computer to perform specific operation. E.g., MOV – move, ADD - addition, SUB – subtraction, RD - read.
RD PAT, 15 (read the value 15 stored in the processor register named PAT)
SUB PAT, 10 (subtract 10 from the value in register PAT)
A program written in an Assembly language cannot be executed/obeyed by the computer hardware directly. To enable the CPU understand Assembly language instructions, an Assembler (which is stored in a ROM) is used to convert them into Machine language.
The Assembler accepts the source codes written in an Assembly language as its input, and translates them into their corresponding computer language (machine code/ object code) equivalent.
Comments are incorporated into the program statements to make them easier to be understood by the human programmers.
Assembly languages are machine-dependent. Therefore, a program written in the Assembly language for a particular computer cannot run on another make of computer.
Advantages of Low-level languages
Disadvantages of Low-level languages
Very few computer programs are actually written in machine or Assembly language because of the following reasons;
HIGH-LEVEL PROGRAMMING LANGUAGES
High-level languages were developed to solve (overcome) the problems encountered in low-level programming languages.
The grammar of High-level languages is very close to the vocabulary of the natural languages used by human beings. Hence; they can be read and understood easily even by people who are not experts in programming.
Most high-level languages are general-purpose & problem-oriented. They allow the programmer to concentrate on the functional details of a program rather than the details of the hardware on which the program will run.
High-level language programs are machine-independent, (i.e., they do not depend on a particular machine, and are able to run in any family of computers provided the relevant translator software is installed).
Programs written in a high-level language cannot be obeyed by the computer hardware directly. Therefore, the source codes must be translated into their corresponding machine language equivalent. The translation process is carried out by a high-level language software translator such as a Compiler or an Interpreter.
Features of high-level programming languages.
Purpose of High-level languages.
Advantages of High-level languages.
Disadvantages of using High-level languages
TYPES OF HIGH-LEVEL LANGUAGES
High-level languages are classified into five different groups:
The various types of high-level languages differ in:
A structured (procedural) language allows a large program to be broken into smaller sub-programs called modules, each performing a particular (single) task. This technique of program design is referred to as structured programming.
Structured programming also makes use of a few simple control structures in problem solving. The 3 basic control structures are:
Advantages of structured programming.
Examples of Third generation programming languages include:
FOURTH GENERATION LANGUAGES (4GL’S).
4GLs make programming even easier than the 3GLs because; they present the programmer with more programming tools, such as command buttons, forms, textboxes etc. The programmer simply selects graphical objects called controls on the screen, and then uses them to create designs on a form by dragging a mouse pointer.
The languages also use application generators (which in the background) to generate the necessary program codes; hence, the programmer is freed from the tedious work of writing the code.
4GLs are used to enquire & access the data stored in database systems; hence, they are described as the Query languages.
Purpose of fourth generation languages.
The 4GL’s were designed to meet the following objectives: -
Examples of 4GLs are:
Advantages of fourth generation languages.
FIFTH GENERATION LANGUAGES (5GL’S).
The 5GL’s are designed to make a computer solve a problem by portraying human-like intelligence.
The languages are able to make a computer solve a problem for the programmer; hence, he/she does not spend a lot of time in coming up with the solution. The programmer only thinks about what problem needs to be solved and what conditions need to be met without worrying about how to implement an algorithm to solve the problem.
5GLs are mostly used in artificial intelligence.
Examples of 5GLs are:
OBJECT-ORIENTED PROGRAMMING LANGUAGES (OOPs)
Examples of Object-oriented programming languages are: -
WEB SCRIPTING LANGUAGES.
Comparison of Programming languages.
Factors to consider when choosing a Programming language.
The following factors should be considered when choosing a Programming language to use in solving a problem: