Computer Languages
Human languages are those which we use to communicate to one another. Similarly computers have different languages so that the user can communicate with them to give instruction to carry out any desired task.
Computer languages can generally be classified into the following categories.
I. Machine languages
II. Assembly languages
III. High-level languages
I) Machine languages:
Machine languages are those which the computer can directly understand. The commands in machine language will be binary form. For example, the machine language command for adding two numbers may be some thing like 10110011. These commands will generally be written in hexadecimal form (Base 16 numbers. The hexadecimal representation for the above binary number is ‘B3’. The machine language commands will be different for different computers.
II) Assembly languages:
The assembly language is one step forward from the machine language. In the assembly language the machine language commands are represented as understandable words. For example the command for adding a number to another might look like ‘Add B’, and the command to increment a number by 1 like ‘INC D’, etc. These commands will then be translated into machine language commands by a software called the Assembler. Assembly language programs are also machine dependent, i.e., the programs written for one type of computer may not execute in another type of computer.
III) High Level languages:
High level languages are those in which we can use English like commands to instruct the computer. These languages are easy to learn. They can be used on any computer independent of the hardware type. Examples for high level languages are BASIC, FORTRAN, COBOL, Pascal, C, etc. The programs that convert these High-level language commands into machine language commands are compilers and interpreters.
Compilers:
Compilers are those which convert the high level language program directly into machine language commands. To execute the program we only need the COMPILED version of our program. Examples for compilers are FORTRAN, COBOL, Pascal, C, etc.
Interpreters:
Interpreters are those which convert the high level language programs into an intermediate form. To execute the program we will need both the program and the interpreter. BASIC language is one example for the interpreted languages.
Program
A program is set of instructions for performing a particular task. These instructions are just like English words. The computer processes the instructions as 1s and 0s.
Source Program
A program can be written in assembly language as well as high-level language. This written program is called ‘source program’.
Object Program
The source program is to be converted to the machine language, which is called ‘object program’.
Either an interpreter or compiler will do this activity.
a) Interpreters: An interpreter reads only one line of a source program at a time and converts it to the object codes. In case of errors, the same will be indicated instantly. The program written with an interpreter can easily be read and understood by other users. Therefore security is not provided. Anyone can modify the source code. Hence, it is easier than compilers. However, the disadvantage is that it consumes more time for converting a source program to an object program.
Compilers: Compiler reads the entire program and converts it to the object code. It provides errors not of one line but errors of the entire program. Only error-free programs are executed. It consumes little time for converting a source program to an object program. When the program length for any application is large, compilers are preferred.
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment