Program Translators
A computer can only understand programs defined using machine code. A program written in a high level language such as java cannot be run directly. To execute a computer program written in high or low level language, it must be first be translated. Source code is the code that is input to a translator and executable code is the code that is output from the translator.
There are three types of system software used for translating the code that a programmer writes into a form that the computer can execute.
Assemblers
Assembler is a computer program which is used to translate program written in assembly language in to a machine language. The translated program is called as object orientated program. Assembler checks each instruction for its correctness and generates diagnostic messages, If there are mistakes in the program. Various steps of assembling are used:
1. input source program in assembly language through an input device.
2. Use assembler to produce object orientated program in machine language
3. Execute the program.
Compilers
compiler is a program that translates a programme written in high level languages to executable machine language. The process of transferring high level languages source program in to object code is a lengthy and complex process as compared to assembling. Compilers have diagnostic capabilities and prompt the programmer with appropriate error message while compiling a high level language program. The corrections are to be incorporated in the program, whenever needed, and the program has to be recompiled. The process is repeated until the program becomes mistake free and translated to an object code. Thus the job of a compiler includes the followings
1. To translate HLL source program to machine codes.
2. To trace variables in the program.
3. To include linkage for subroutines.
4. To allocate memory for storage of program and variables.
5. To generate error message, if there are errors in the program.
Interpreter is a program which translates statements of a program into machine code. It translates only one statement of the program at a time. It reads only one statement of program, translates it and executes it. Then it reads the next statement of the program again and translate it and executes it. In this way, it proceeds further till all the statements are translated and executed. On the other hand, a compiler goes through the entire program and then translates the entire program into machine codes. a compiler is 5 to 25 times faster than an interpreter.
0 Comments