Pages

Saturday, March 2, 2013

Programming Language Translation

We have seen in the previous sections that a computer can execute programs written only in a machine code. Therefore a programme written in any other language has to be translated into machine code by using appropriate language translation software to execute it on the computer. The process of converting a program from one language to another is termed Language Translation. There are three techniques for
language translation:
(1) Assemblers
(2) Compilers
(3) Interpreters

1 Assemblers
Assemblers translate assembly language into machine language which can be
recognized by the computer.

2. Compilers
Compilers translate all the commands in a program to an object code which can be understand by the computer. Once a program is compiled, it can be executed by the machine. C and FORTRAN are two
examples of compiler based programming languages.
   When compiling programs, the original program used for the compilation is called the Source Code Program and the resulting program produced by the compiler is called the Object Code Program. The main process what the compiler does is to translate Source Code Program into Object Code Program. During the compilation process, the compiler also checks whether the source program is free of errors with respect to the grammar of the programming language. If the compiler detects errors, error messages are produced and the compilation process terminates without producing the object code. Then the user must compile the program again after correcting the detected errors. The user may have to follow this procedure repeatedly until the program is free of errors. Errors found in a program are called ‘Bugs’ and the process of
eliminating bugs from a program is called Debugging.

3. Interpreters
Unlike compilers, interpreters do not translate the entire program into machine code at once. Instead, an interpreter does the translation at the moment the program is run, one line at a time. As a result, the lines of the program have to be translated into machine code each time the program is run. Therefore, the time taken
to run a program of this type is typically greater than the time taken to run a similar program that has been compiled. ‘VB’ and ‘Python’ are examples of such languages.

Evolution of Programming Languages

All programming languages developed from the inception can be classified into four classes based on the nature of their commands.

1' First Generation Programming Languages
(Machine Languages)

2' Second Generation Programming Languages
(Assembly Languages)

3' Third Generation Programming Languages
(High Level Languages)

4' Fourth Generation Programming Languages
(Artificial Languages)

One of the key features apparent in the evolution of programming languages is that the programming languages have become easily understandable and usable over the years.

First Generation Programming Languages
All machine languages fall into this category.
Common Properties of these languages:
  •  All commands are based on the binary code symbols 0 and 1.
  • Coding programs and programming computers are extremely difficult.
  • Depend on the machine type. Therefore, a program coded for one processor type may not run on a machine with a different processor type.
  • Programmer should have a comprehensive knowledge about the hardware of the intended computer system.
Second Generation Programming Languages
These languages were developed primarily to alleviate the problem of using
only the binary symbols 0 and 1 to develop programs.
Common Properties of these languages:
  •  Commands are represented by symbolic names such as ‘ADD’,SUB’.
  •  Ability to use symbolic names to store data at memory locations and to retrieve data from memory by using these symbolic names.
  • Ability to debug programs easier than programs in machine code.
  •  Depend on the machine type.
  • Need for Programmer to have comprehensive knowledge of hardware of the intended computer system.
Programs written in Assembly Languages cannot be executed directly on the computer as Assembly Languages are not understood by the processors. Instead, such programs have to be transformed into the machine language of the intended computer using appropriate language translation software. Such language translation software that translate programs written in Assembly Languages to Machine Language are called ‘Assemblers’.

Third Generation Programming Languages
Programming languages such as C and VB belong to this type.
Common Properties of these languages:
  •  Based on languages close to humans such as English .
  •  Do not depend on the machine.
  •  Programs can be developed and debugged easily.
Like the Assembly languages, these languages also cannot be directly understood by the machines. Therefore to execute programs written in these languages they have to be translated into machine code using
appropriate language translation software.

Fourth Generation Programming Languages
Fourth Generation Programming Languages provide Visual Environment
making it easy for the user to write computer programs.
Common Properties of these languages:
  • Close to human languages such as English.
  •  Ability to learn the languages within a short period.
  •  Ability to accomplish a task by using a smaller number of commands relative to Third Generation Programming Languages.