Webocreation

Tuesday, June 16, 2009

#) Explain about programming languages.

#) Explain about programming languages.
Programming Languages
Ans: A programming language is one which a computer programmer uses to express solution to a given problem so that it can be understood by a computer. There are many similarities between programming languages and speaking (natural) languages. Just as there are many speaking languages, like English, French, Nepali, so too there are many programming languages, like FORTRAN, Pascal, COBOL, Basic, PL/1 and C. Each programming language has its own grammatical (.syntax) rules which must be obeyed in order to write valid programs, just as a natural language has its own rules for forming sentences. And just as we can assign a meaning to an English sentence, say, each valid statement in a programming language has a specific meaning.
Let us suppose that we have written a program in the programming language C or QBASIC. We might think that the computer can understand and execute the statements, which make up the program C or QBASIC. However, this is not so, at least not directly. The program must first be translated into the (only) language which the computer can understand-this is called the machine language. The act of translating is part of a process called compiling. It is important to understand that the computer can only execute instructions, which are written in machine language. Thus no matter what programming language we use, it must first be translated into machine language before the computer can understand it.
Types of Language
1. Machine Language
When computers were first used, machine language was the only language available for writing programs. Machine language varies from one computer to another, but the basic principles are essentially the same. Everything one wishes to express in machine language is done using the binary number system. In order to illustrate the ideas involved, we will use a computer which has the following features:
a) Say 9999 words of memory, then it is numbered as 0 to 9998
b) A set of instructions, in which the computer can be programmed.
The fact is that a single human instruction to the computer is broken down into a series of simple steps. Computer instructions can be roughly classified as:
-instructions which move data from one word of memory to the next;
-instructions which move data between memory and the accumulator (where arithmetic can be done on it);
-instructions for performing the arithmetic operations ADD, SUBTRACT, MULTIPLY and DIVIDE;
-instructions for comparing two quantities;
-instructions for branching from one instruction to another, that is, for changing the normal order of executing instructions one after the other;
-instructions for performing input/output;
2. Assembly and low level languages
Assembly language is usually called a low-level programming language. We usually think of machine language, that is binary instructions, as the lowest-level programming language. Assembly language is a bit higher than machine language. Each computer has its own assembly language and it differs from computer to computer. Assembler translates or converts the program written in assembly language into machine code.
3. High level languages
The problem oriented languages rather than machine oriented languages are HLL. English words are used as instructions. Fortran and Cobol are the earliest and Pascal, PL/1, Basic, C are the popular. HLL are machine independent languages. A program is said to be portable if it can be used on other computers. Program written in HLL are portable

No comments:

Post a Comment