Explain the role of a translator program. How is a compiler different than an assembler?

A translator is a program which converts statements  written in one language to statements in another language especially to machine language.

There are three types of translators:

  • Assemblers
  • Compilers
  • Interpreters

The Assembler:

This is a program, which translate assembly language into machine code. One machine instruction is generated for each source instruction. The resulting program can only be executed when the assembly process is completed. The assembler reserves space for the instructions and data, replaces mnemonic operating codes by machine codes and symbolic addresses by numeric addresses while it determines the machine representation of constants.

Functions of the Assembler:

  1. It translate mnemonic operation codes, and symbolic addresses into machine addresses.
  2. Includes the necessary linkages for closed subroutines and insert appropriate machine code for macros.
  3. Allocates area of storage.
  4. Detects and indicates invalid source language instructions.
  5. Produces the object program on disk as required.
  6. Produces a printed listing of the source and object program with comments.

The Compiler:

Compiler translates a high level language into machine language. The compiler translate the whole source program into machine code or object program prior to the object being loaded into main memory and execution. The resulting program can only be executed when compilation is completed. The storage of the object program into a diskette facilities future usage of the high level language source program any other time it is needed.

How the Compiler Does Assembler Work?

  1. Translates the source program statements into machine code.
  2. Includes linkage for closed subroutines.
  3. Allocates areas of main storage.
  4. Generates the object program on cards, tapes or disc as required.
  5. Produces a printed copy of the source and object program when required.

Tabulates list of errors found during program compilation e.g. the use of ‘word’ or statement not included in the language vocabulary, the rule of syntax or lexis.

Tags: Bca

Owlgen
Logo
Enable registration in settings - general
Compare items
  • Total (0)
Compare
0