Once the planning for a computer program has been done, the next step in its development is to write the specific steps for solving the problem at hand in a language and form, which is acceptable to a computer system. A language that is acceptable to a computer system is called a computer language or programming language and the process of writing instructions in such a language for an already planned program is called programming or coding. The aim of this article is to introduce some of the common computer languages which are used for writing computer programs.
ANALOGY WITH NATURAL LANGUAGES
A language is a means of communication. We use a natural language such as English to communicate our ideas and emotion to others. Similarly a computer language is used by a programmer to instruct a computer what he/she wants it to do.
All natural languages (English, French, and German etc) use a standard set of words and symbols for the purpose of communication. These words and symbols are understood by everyone using that language. We normally call the set of words allowed in a language the vocabulary of the language. For example, the words we use in English form the vocabulary of English language. Each word has a definite meaning and can be looked up in a dictionary. In a similar manner all computer languages have a vocabulary of their own. Each word of the vocabulary has a definite unambiguous meaning which can be looked up in the manual meant for that language. The main difference between a natural language and a computer language is that natural languages have a large vocabulary but most computer languages use a very limited or restricted vocabulary. This is because a programming language by its very nature and purpose does not need to say too much. Every problem to be solved by a computer has to be broken down into discrete logical steps which basically comprise of four fundamental operations input and output operations, arithmetic operations movement of information within the CPU and memory and logical or comparison operations.
Each natural language has a systematic method of using the words and symbols of that language, which is defined by the grammar rules of the language. Similarly the words and symbols of a computer language must also be used as per set rules which are known as syntax rules of the language. In case of a natural language people computer language we must stick to the exact syntax rules of the language if we want to be understood correctly by the computer. Yet no computer is capable of correcting and deducing meaning from incorrect instructions. Computer languages are smaller and simpler than natural languages but they have to be used with great precision. Unless a programmer adheres exactly to the syntax rules of a programming language, even down to the punctuation marks his/her instructions will not be understood by the computer.
Over the years programming languages have progressed from machine-oriented languages which use strings of binary 1s and 0s, to problem-oriented languages which use common mathematical and/or English terms. However all computer languages can be broadly classified into the following three categories.
1. Machine language
2. Assembly language
3. High-level language
MACHINE LANGUAGE
Although computers can be programmed to understand many different computer languages there is only one language understood by the computer without using a translation program. This language is called the machine language of the computer. The machine language of a computer is normally written as strings of binary 1s and 0s. The circuitry of a computer is wired in a manner that it immediately recognizes the machine language instructions and converts them into the electrical signals needed to execute them.
A machine language instruction normally has a two-part format .The first part of an instruction is the operation code which tells the computer what function to perform and the second part is the operand which tells the computer where to find or store the data or other instructions which are to be manipulated .Hence each instruction tells the computer what operation to perform and the length and locations of the data fields which are involved in the operation. Every computer has a set of operation codes called its instruction set. Each operation code in the instruction set is meant for performing a specific basic operation or function. Typical operations included in the instruction set of a computer are as follows:
1. Arithmetic operations
2. Logical operations
3. Branch operations (For transfer of control to the address given in the operand field)
4. Data movement operations (For moving data between memory locations and registers)
5. Data movement operations (For moving data from/to one of the computers input/output devices)
Although some computers are designed to use only single-address instructions many computers use multiple-address instructions which include the address of two or more operands. For example the augends and addend may be the two operands of an addition operation.