A computer program is basically a set of instruction which when executed by the computer do a specific task. The CPU processes the data as per the instruction given to it. The instruction is written using various syntax and rules. Programming language provides the set of rules / syntax/ instruction format in which the various instructions are written. There are three types of programming languages:
- High level languages
- Assembly languages
- Machine languages(low level language)
Low level language: a language in which each statement or an instruction is directly translated in to a single machine code.
E.g. Machine language.
Machine code: it contains the string of binary numbers (0’s and 1’s) and is machine dependent. It means that the machine language for every processor is different. It is referred as 1’st generation language.
The machine language is divided in to two pats
- Operation code (op code)
- Operands (binary data)
Ex. consider the following m/c language instruction of the microprocessor 8085
This program adds two hexadecimal number 20H and 30H stored in register A& B. the result is stored in register C.
Hexadecimal code Binary Code Remark
3E 00111110 move the data 20 to register A
06 00000110 move the data 30 to register B
80 10000000 add the content of A & B
4F 01001111 moves the result from accumulator to register C
The main advantage of machine language is that the processor can create it without any translation
The disadvantage of machine language is as follow:
- It is very difficult to remember
- Machine dependent, so same code can not be used for different machine.
In assembly language the 0’s and 1’s of machine are replaced by abbreviation or mnemonics code. It is referred as second generation language .An assembly language instruction consist of a mnemonics code followed by zero or more operands. During execution, assembly language program is converted in to machine code with the help of assembler.
For e.g. MVI A, 20H 3E 00111110
ADD A, B 60 0110111
- Reduced programming complexity.
- It is easy to find error and also easy to debug.
- I t is easy to develop program than machine language.
- The coding of assembly language is time consuming
- It is also machine oriented as the code for one machine is not used by the other one.
High level language:
To overcome the problem of the low level language, the high level languages were developed. High level languages are machine independent.
- It is easier to learn
- It is easier to maintain
- They provide better documentation
For e.g. COBOL, BASIC, PASCAL, C are all high level languages.
Each high level languages provides its own construct/ syntax and setoff statements.