Program translation

Remember : Computers can only execute binary machine code instructions. Any program written in another language must be converted into machine code before the program can be run.

Assembler

An assembler is a program which converts a low-level (assembly) language program into executable code.

Each mnemonic is replaced by its corresponding binary machine code instruction.

 

There are two main types of translator for high level language programs :

Compilers and Interpreters.

A compiler translates a complete source code program into machine code.

An interpreter analyses the source code statement by statement as execution proceeds, interpreting the meaning of each statement and calling routines to carry out each instruction.

Advantages of a compiler :

  • a compiled program runs faster than an interpreted program.
  • the compiled object program may be saved on disk and run as many times as required without being recompiled.
  • a compiler checks all lines of coding whereas an interpreter only checks the ones executed. This means that some branches may go untested for a long time and then suddenly one day...crash!
  • compiled code cannot be listed and altered.

Advantages of an Interpreter :

  • Easier program development.
  • Usually occupies less storage (memory or backing store).
  • Interpreters are less complex pieces of software so...cheaper to buy.