Translate

Total Page Views


Wednesday, January 30, 2013

Introduction to Programming

Languages

In Sri Lanka people use three languages Sinhala, Tamil and English. The purpose of a language is to allow people to communicate. If we want to communicate with a computer it would be ideal if you could use a language like English. Unfortunately computers at present are not intelligent enough to understand human languages. Because of this computer scientists have developed computer friendly languages. These computer languages could be learnt relatively easily by people. Using such a computer language you can communicate with a computer. More specifically you could instruct the computer to perform a particular task.

Computer Languages Generations

First Generation Computer Languages
In the computer there is a component called the central processing unit (CPU). The main purpose of the CPU is to execute instructions given to the computer. The instructions even a modern day computer can understand directly are numbers given in binary format. This language is called machine code (See Fig 4.1). This is the language that a computer really understands. Machine code is dependent on the type of CPU your computer has. The Intel Pentium IV is the CPU used in new personal computers. There are older versions of this CPU, e.g. Pentium III, Pentium II, 80486, etc. These belong to a family of processors called the Intel 80x86. The machine code in these processors are similar. There are other types of CPUs like the PowerPC used in Apple computers, UltraSparc used in Sun Workstations. The internal design of these CPUs are very different from the Intel 80x86 family of processors. Because of this, machine code of these processors are different from the Intel processors.

If you think of a calculator it could add, substract, multiply. These are the operations it can perform. A CPU of a computer has instructions to mainly perform arithmetic calculations such as add and logical operations such as or, and etc.. The instructions supported by the CPU are called the instruction set. People do not instruct computers using machine code today. But when the first electronic computers were developed during the 1940s, the only type of computer language that was available was machine code. Computer scientists had to literally write all instructions using numbers. Machine Code is an example of a first generation computer language.

Second Generation Computer Languages

Using machine code was very difficult and error prone so in the 1950s they came up with the idea of using simple English words to replace the numerical instruction codes. These words were called mnemonics, and this computer language was named as Assembly. 

Now the computer scientists could give instructions using simple words. They next converted these instructions into machine code so that the CPU could understand them using a software developed called an Assembler.

In Assembly every assembly instruction corresponds to a machine code instruction. Since Assembly languages corresponded to machine code, each different type of CPU has its own type of assembly. Assembly is still used today to program small electronic devices because assembly programs are more efficient in speed and requires the least amount of memory compared to programs developed using third generation languages (See 41.2.3).. Assembly is classified as a second generation computer language. Both machine code and assembly are called low level languages.

                                   Machine Code                                           Assembly
Assembly, machine code 

0 comments

Post a Comment