Article No: 6
As we know that without software computer box is useless. So to make software we require set of instructions known as programs. To write any program, a standard programming language is used.
A language is a means of communication.We use a natural language such as English to communicate our ideas and emotions to others. Similarly, a computer language is a means of communication used to communicate between people and the computer. With the help of a computer language, a programmer tells a computer what he/she wants it to do.
All natural languages (English, French, German, etc.) use a standard set of words and symbols (+, -, :, ;, <, >, etc.) 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 that particular language. For example, the words we use in English form the vocabulary of an 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 mainly because a programming language by its very nature and purpose does not need to say too much. Each and every problem to be solved by a computer has to be broken down into discrete (simple and separate), 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 symbols of that language which is defined by the grammar rules of the language. These rules tell us how to use the different words and symbols allowed in the language. Similarly, the words and symbols of a particular computer language must also be used as per set rules, which are known as the syntax rules of the language. In case of a natural language, people can use poor or incorrect vocabulary and grammar and still make themselves understood. However, in the case of a computer language, we must stick to the exact syntax rules of the language if we want to be understood correctly by the computer. As 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 follows exactly to the syntax rules of a programming language, even down to the punctuation mark, his/her instructions will not be understood by the computer.
Programming languages have improved over the years, just as computer hardware has improved. They have progressed from machine-oriented languages that use strings of binary 1s and 0s to problem-oriented languages that use common mathematical and/or English terms. However, all computer languages can be broadly classified into the following three categories as per shown in below diagram:
FIGURE 1.7 Programming Languages
Machine Language
It is a language made up of binary numbers (known as bits) consisting of 1’s and 0’s to which the computer can understand easily. The machine language is also known as machine codeand machine code is also known as native code. E.g. suppose there are three subjects’ marks to be added and store in result variable, than code in machine language will be as:
11000101 = 11110001 + 11101010 + 10100011
FIGURE 1.8 Source code directly into object code
A machine language instruction generally has two parts as shown in figure. The first part is the command or operation code that sends to the computer what function has to be performed by the instruction. All computers have operation codes for functions such as adding, subtracting, and moving. The second part of the instruction either specifies that the operand contains data on which the operation has to be performed or it specifies that the operand contains a location where the operands are situated like RAM, registers . . .etc.
FIGURE 1.8 General format of machine language instruction
FIGURE 1.8 ADD Instruction format
Here, in figure (last), the first part contains operation code (+), second part contains operand (data) 20, and third part contains second operand 30. When this instruction will be executed, compiler will identify the operation to be done by operation code. With the help of operation code, compiler can also know that what the length of instruction is. Here in diagram, operation code is ADD which means that compiler must add two operands (20 and 30).
FIGURE 1.8 Instruction containing addresses of operands.
Here in this figure, instead of operands their memory addresses are stored. In second part of the instruction, 101 is the address of operand 20, and in third part of the instruction, 102 is the address of operand 30. When compiler will execute this instruction, it will find the operands through its addresses.
Advantages of Machine Language
· No translation of program is required because CPU can understand directly.
· It execute fast.
· It occupies less memory than assembly and high level language.
Disadvantages of Machine Language
· It is difficult to develop programs for programmers.
· Finding errors in it is very difficult.
· The programmer must know internal design of hardware to make any program.
· All operation codes and memory addresses have to be remembered.
· These languages are machine dependent, means program written for one computer cannot be used in other computer.
Assembly Language
When symbols such as letters, digits, or special characters are used for operation, then this language is known as assembly language.Symbols can also be referred as mnemonic codes because it has combination of maximum 3 or 4 characters, such as ADD for addition, SUB for subtraction, MUL for multiplication. Because of this feature it is also known as Symbolic Programming Language.To convert the code into machine language assembler is used.E.g. same example of adding three subject marks is shown in assembly language.
LOAD MARKS1
ADD MARKS2
ADD MARKS3
STORE RESULT
FIGURE 1.9 Source code converted into object code through Assembler
Advantages of Assembly Language
· Writing a program in assembly language is easier than writing in machine language
· It is easy to modify
· It is easy to use and understand
· Finding errors is easy than machine language
Disadvantages of Assembly Language
· Like machine language it is also machine dependent
· Developing programs is difficult and time consuming
· The programmer must have knowledge about logical structure of the computer
· Assembler required to translate the program
High-level Language
High level computer languages give formats close to English language and the purpose of developing high level languages is to allow people to write programs easily and in their own native language environment (English). High-level languages are basically symbolic languages that use English words and/or mathematical symbols rather than mnemonic codes. Each instruction in the high level language is translated into many machine language instructions. To convert the code into machine level language, compiler is used. E.g. adding marks of three subjects:
Result = Marks1 + Marks2 + Marks3
FIGURE 1.10 Source code converted into object code through Compiler
Advantages of High-level Language
· Programs written in this language are more readable than those written in assembly and machine languages.
· It is easier to learn
· Requires less time to develop programs
· Easier to maintain
· It is independent of machine, means program written for one machine can be run on other machines
· Error checking is easy
Disadvantages of High-level Language
· A high-level language has to be translated into the machine language by a translator and thus a price in computer time is paid.
· he object code generated by a translator might be inefficient compared to an equivalent assembly language program.
Compiled By: Chaudhary Amit V.
Compiled By: Chaudhary Amit V.





Comments
Post a Comment