To communicate with a computer, we use computer languages or also known as programming languages. To write a program, we must use the computer languages. A computer language is a set of predefined words that are combined into a program according to predefined rules (syntax). Over the years, computer languages had evolved from machine language to high-level languages.
There are generally three types of computer languages. They are: 1. Machine Language, 2. Assembly Language and 3. High-level languages.
In the earliest days of computers, the only programming languages available were machine languages. Each computer has its own machine language which is made up of streams of 0’s and 1’s. The only language understood by a computer is the machine language. This language is tightly coupled with the computer hardware. It is difficult to write and maintain code in machine language.
The next evolution in programming came with the idea of replacing binary code for instruction and addresses with symbols or mnemonics. Because they used symbols, these languages were first known as symbolic languages. The set of these mnemonic languages were later referred to as assembly languages. It is easy to write and maintain programs in assembly language than in machine languages.
Although assembly languages greatly improved programming efficiency, they still required programmers to concentrate on the hardware they were using. Working with symbolic languages was also very tedious, because each machine instruction had to be individually coded. The desire to improve programmer efficiency and to change the focus from the computer to the problem being solved led to the development of high-level languages.
Examples of high-level languages are:
- BASIC (Beginners All Purpose Symbolic Instruction Code).
- FORTRAN (Formula Translation).
- PL/I (Programming Language, Version 1).
- ALGOL (Algorithmic Language).
- APL (A Programming Language).
- COBOL (Common Business Oriented Language).
- RPG (Report Program Generator).
- LISP (List Processing).
- Prolog (Program in Logic).
- Visual Basic
Programs today are normally written in one of the high-level languages. To run the program on a computer, the program needs to be translated into the machine language of the computer on which it will run. The program in a high-level language is called the source program. The translated program in machine language is called the object program. Two methods are used for translation: compilation and interpretation.
A translator is a program, which converts the code written in one language into another language. The widely used translators are compilers and interpreters.
A compiler is a translator which converts the program written in high-level language into assembly code or into another form of intermediate code or directly into machine code. A compiler converts the whole source code at once into object code and then executes it. So, compiler is faster than a interpreter.
An interpreter is a translator which converts the source program into object or machine code. The interpreter converts the source code line-by-line and executes it immediately, which results in less performance. Thus, an interpreter is slower than a compiler.
Generations of Programming Languages
There are five generations of programming languages. There are classified based on how close the programming language is to human beings.
First Generations Languages (1GL): The first generation language is the machine language. It consists of only 0’s and 1’s. It is very difficult write programs in machine language.
Second Generation Languages (2GL): The second generation language is the assembly language. Assembly language consists of symbols known as mnemonics, English words rather than 0’s and 1’s. Programs written in assembly language are converted to machine language using a translator known as assembler.
Third Generation Languages (3GL): The third generation languages are high-level languages which are similar to English. It is easy to write programs using high-level languages. Programs written in high-level language are converted to machine language by using a translator like compiler or interpreter. Third generation languages are problem oriented languages. Examples: C, FORTRAN, COBOL, PASCAL etc.
Fourth Generation Languages (4GL): The fourth generation languages are non-procedural languages. Programmers have to specify only what to do but not how to do it. These languages are developed for users having minimum programming language. Examples: SQL, ABAP etc.
Fifth Generation Languages (5GL): The fifth generation languages are declarative languages which are used in artificial intelligence and expert systems. Example: Prolog etc.