The step by step set of instruction given to the computer that specifies how to perform the required task is called program and language is the way of communication of users to the computer with the help of that user can share thought, feeling to the computer. So, the language used to developed program is called programming language. A language is used to communicate with the computer or instruct the computer to perform certain tasks are called programming language.
A computer can neither think nor make any decision on its own. So it is impossible for any computer to analyze the given input and follow its own method to generate the solution from it. Every program developed in any language generally tells the computer:
What to do? Where to get the data? Where to store the result? How to present the result?
# Categories of language: - A programming language is a bridge between man and machine. Any computer designed till date can execute only those programs that are represented internally in binary form( sequence of 0’s and 1’s ) and program written in any other language must be translated to binary represented of the instructions before the computer can execute those program. Programming language can be categorizes as:
1. Machine level language or 1st generation language.
2. Assembly level language or 2nd generation language.
3. High level language.
- Procedural language or 3rd generation language.
- Problem oriented language or 4th generation language.
4. Natural language or 5th generation language
1. Machine Language: -
The lowest level language in which every program statement is written using series of 1’s and 0’s and is directly understandable by CPU is known as machine language. Since it is very close to the hardware and is in the lowest level in the programming hierarchy, it is also called low level language. Machine language was used in first generation computers so it is considered to be first generation language. Any instruction written in a machine language will have at least two parts the first part is the command or operation part which tells the computer what function to perform. The entire computer will have an operation code for each of its instruction function. The remaining parts of instructions are the operand which tells the computer where to find or store the data that has to be manipulated. Since machine language is difficult to use by general users and non-professionals so, to develop a program in machine language, one must have the knowledge of technical details of operation of computer.
Advantages: -
- This is the language native to CPU; the program written in machine language runs fastest in CPU.
- It does not need any translation.
Disadvantages: -
- Machine language is difficult in understanding.
- Program checking will have to face great difficulty to understand it.
- This is the most difficult way to write a computer program and the chance of error is also high due to the type error even if 1 bit changes, the whole meaning may change.
- It needs a lot of instruction for writing a very small program.
Note: - Each type of processor has its own machine code; a program written for one type of processor is not executable by any other. Machine code for INTEL processor does not work for MOTOROLA processor.
2. Assembly Language:-
Since the machine language codes are difficult to learn and remember, program code become lengthy and almost impossible to write and debug the errors, a new language was developed which uses symbol notations for writing a program is called assembly language. The symbolic notations used in assembly language are called mnemonics.
This language is considered to be the second generation language because this was firstly used in second generation computers. Assembly language reduces the complexity and provides the standardization to some extent by using English words like ADD, SUB, MUL, DIV, HALT etc. Each line of an assembly language is arranged in three columns called fields. The fields specify the following information.
- The label field may be empty or it may specify a symbolic address.
- The instruction field specifies a machine instruction or a pseudo instruction.
- The comment field may be empty of it may include a comment.
Machine and assembly languages are referred as low level language, since the coding for a problem is at the individual instruction level. Each machine has got its own assembly language, which is dependent up on the internal architecture of the processor.
A machine can not execute program written in an assembly level language as it is not in a binary form. So it needs to translate in machine form.
Translator: - A language translator is system software which translates a computer program written by a user into a machine understandable form. Compilers interpreters and assemblers are the examples of the language translators.
Assemblers: - A computer program which converts the assembly level language into machine language instruction is known as assembler.
Advantages: -
-It is convenient to write program and little more readability as symbolic instructions are used instead of binary sequence.
- Close to machine language and hence faster execution than other.
- Efficient than high level language.
- Little more readability, more standardization, comparatively easy to learn and use ad symbolic notations are used.
Disadvantages:
- Assembly language program is specific to particular machine architecture that is program written for one processor will not work on a different processor if it is architecturally different. So assembly language is not portable.
- Assembly language program is not as fast as machine language. It has to be first converted into machine language.
- Program development is still slow and tedious job.
# High Level Language: -
The language which uses English structures and mathematical notations to create a program, which is simple, clear and easy to understand in comparison to 1GL and 2GL, is called high level programming language. This language is also referred to as third generation language. These are machine independent and portable language because program developed for one computer can be run on another computer with no modification.
A single statement may be sufficient to perform some task in high level language. The time and cost of creating such language is very less so most of the programmers motivated for development of use of high level language like C, C++, and Java etc.
Since high level language instructions are not executable form so a language source program is read as input by a program called translator (compiler or interpreter) which checks its syntax and if it is free from errors translates into an equivalent machine codes called object program. If source code contains errors, the translator generates no. of messages indicating the nature of errors and where they occur.
Compiler: - Compiler is software that takes the complete high level program as input and translates it in terms of machine level language instructions (object code). The act of running compiler program is called compiling and the process of translation from source code to object code is called compilation. Compiler scans the entire program first and then translates it into machine code. I.e. it converts the entire program to machine code, when all syntax error is removed and then only execution can start.
· It translates the whole program at a time.
· It converts source code directly into object code.
· It takes some time to generate an executable program.
· Compiled program runs faster.
· It takes less time for translation.
· Useful for both small and large programs.
· It is not required to translate the program each time you want to runt the program.
Interpreter: - An interpreter is a translator which translates high level language into a machine level language. However working mechanism is different from the compiler. The interpreter reads each line of the program instruction determines what they mean and sends the appropriate binary to computer. So it translates the program statement by statement. Each time program is executed; every line is checked for error and then converted into machine code so more execution time is required.
- It translates each line of source code in succession without looking at the entire program.
- It translates source code into intermediate form.
- Interpreted program run slower than the compiled program.
- It can be time consuming compared to compiler.
- Useful for adding small sections of a program at a time and testing them quickly.
- It is required to translate the program each time you want to run the program.
# Procedure oriented language (3 GL): - The procedure oriented languages are general purpose languages based on the idea of modularity, where entire program is divided into modules. Again each module is composed of one or more procedures called functions or subroutines. These are oriented towards the procedure for solution rather than instructions. So, it needs step by step instructions in sequence.
Features:
- Statements are similar to English and easy to use.
- Programs are easy to understand and modify.
- Easy to testing and debug.
- Less time consuming to develop program.
- Standardized and machine independent. E.g. COBOL, FORTRAN, C, C++, JAVA etc.
# Problem oriented language: - The language which is application specific and used to solve specific problems is called problem oriented language. It allows the users to specify what the output should be, without describing all the details of how data should be manipulated to produce the result. These are result oriented and include database query languages. They use English like syntax and easy to use and operate even for general users. E.g. MY SQL.
Features:
- Programmer need know the machine characteristics.
- Easy to find bugs and debug them.
- Coding is faster and easier.
- Use of standard math symbols.
- Standardized, machine independent.
- Code reusability.
No comments:
Post a Comment