Programming Language Generations
A computer is a digital machine. It can only understand electric signals either ON or OFF or 1 or 0. But how do we communicate with this digital machine? Just like there are multiple languages we communicate with each other (e.g., English, Hindi, Tamil, Gujarati, etc.). But computers cannot understand our languages. We can interact with the computer through multiple languages like machine language, assembly language, C, C++, Java, etc.
Computer language: A computer language is a way to give instructions to a computer to perform desired tasks.
Program: A set of instruction written in a specific sequence for the computer to accomplish a given task.
Machine language: The binary medium of communication with a computer through a designed set of instruction specific to each computer.
Assembly language: A medium of communication with a computer in which programs are written in mnemonics. An assembly language is specific to a given computer.
Mnemonic: A combination of letter to suggest the operation of an instruction. E.g, ADD, HALT etc.
Categories of Computer Languages
There are two types of computer languages:
Low-Level Languages: These languages give instructions to a computer in a way that is easily understood by the hardware of the computer. These languages are easier for a computer to understand but difficult for a human understanding. This language is machine-dependent or specific to a given computer. Two low-level languages are Machine Language and Assembly Language.
High-Level Languages: These languages are written in English-like language. Thus, these are easier for a human to understand but difficult for a computer to understand. They can be executed on a machine using a translator. This language is machine-independent. There are many high-level languages eg, C. C++. Java, COBOL, PHP, etc.
Evolution of Computer Languages
A computer can understand instructions in terms of electric signals as it works on electricity. Electric signals are either ON or OFF, or we can say 1 for ON or 0 for OFF. When computers we invented, firstly instructions were given to it in terms of 1’s and 0’s. This form of language is known as Machine Language or the first-generation language.
First Generation Language:
Firstly, computers were given instructions in the forms of 1’s and 0’s. This language is called Machine Language or first-generation language. A computer was able to understand it directly without any conversion. This language is also known as Machine Language or Binary language. Binary language because only two symbols 1 and 0.
Second Generation Language:
Machine Language was just 1’s and 0’s, in which error finding and correcting were very difficult. So we have to develop a second-generation language. Also called an Assembly Language.
In this language, instructions were replaced with some coded terms called mnemonic. So that it becomes a little easier to read, understand, and correct. A computer can understand and work on machine code only. So assembly language needed a special software called Assembler that converts mnemonic into machine language.
Third Generation Languages:
First, two generations of languages were comparatively easier for a computer to understand, but it was difficult for humans to read, understand and code in them. Thus, came English like programming languages to give instructions to computers. These languages are known as High-Level Languages as they are easier for humans to understand.
C, C++, Java, COBOL Pascal, etc. are some High-Level Languages.
Fourth Generation Language:
Third-generation languages require detailed procedures, but fourth-generation languages just require ‘what’ do we want from the code rather than ‘how to do’. i.e., the procedure. These languages are similar to statements in the human language mainly used in database programming. E.g. Python, Ruby, SQL, MatLab.
SQL-Structured Query Language is one such language, e.g. you just write SELECT ALL department Name FROM EmployeeTable to get all the department names: No detailed program is required.
Fifth Generation Languages:
The fifth-generation languages are more focused on artificial intelligence implementation. These have visual tools to develop a program. Prolog, OPSS Mercury, etc. are some SGLS. E.g. Prolog, OPS5, Mercury etc.
Question 1: Discuss the feature of machine language.
(i) Code is written in binary language.
(ii) Binary codes for machine instructions can run directly on hardware.
(iii) No extra tool required for code conversion.
(iv) Machine language depends upon the processor of a computer. So, for a different processor, machine language codes will differ.
Question 2: Discuss the feature of assembly language.
(i) Uses mnemonic codes to represent machine instructions.
(ii) Low-level language.
(iii) Cannot run directly on hardware requires Assembler software that converts it to machine code first.
(iv) Varies from one processor to another, i.e, different assembly codes for different processors.
Question 3: Discuss the feature of a high-level language.
(i) Use English like words.
(ii) Cannot run directly on computer hardware require a translator software to translate high-level instruction code to machine language code.
(ii) Easier to read and understand for us humans (near to humans hence High Level).
(iv) Require coding for the detailed procedure of how the task is to be done.
Question 4: What is a language translator?
A language translator is software that translates a programming languages code to machine language code.
Question 5: What is a compiler?
This is a language translator which converts the entire program into machine code in one go. If there are errors in the program code, it gives the list of errors along with line numbers. The programmer can then correct the program and re-compile the program.
Question 6: What is an interpreter?
This is a language translator which converts a program into machine code line by line. It will first convert the first code line, run it and then move to the second code line. It does not advance if there is an error in any line. We need to correct the code in that line so that interpreter will convert and run the line, and then move to the next line of code.
Question 7: Difference between compiler and interpreter.
Convert the entire program in one go. Convert single instruction at a time. Error list is generated with line numbers after the full program is checked. Errors are generated for one instruction at a time. After compilation, full program runs. Code run line by line. The compiler no longer needs after compilation is done.
An interpreter is always needed.