Topics / Hardware and Software / Translators


Computers only understand machine code (binary), this is an issue because programmers prefer to use a variety of high and low-level programming languages instead.

To get around the issue, the high-level and low-level program code (source code) needs to pass through a translator.  A translator will convert the source code into machine code (object code).

There are several types of translator programs, each able to perform different tasks.


Compiler Diagram

Compilers are used to translate a program written in a high-level language into machine code (object code).

Once compiled (all in one go), the translated program file can then be directly used by the computer and is independently executable.

Compiling may take some time but the translated program can be used again and again without the need for recompilation.

An error report is often produced after the full program has been translated.  Errors in the program code may cause a computer to crash.  These errors can only be fixed by changing the original source code and compiling the program again.


Interpreter Diagram

Interpreter programs are able to read, translate and execute one statement at a time from a high-level language program.

The interpreter stops when a line of code is reached that contains an error.

Interpreters are often used during the development of a program.  They make debugging easier as each line of code is analysed and checked before execution.

Interpreted programs will launch immediately, but your program may run slower then a complied file.

No executable file is produced.  The program is interpreted again from scratch every time you launch it.


Assemblers are used to translate a program written in a low-level assembly language into a machine code (object code) file so it can be used and executed by the computer.

Once assembled, the program file can be used again and again without re-assembly.

Summary of translators

Compiler Interpreter Assembler
Translates high-level languages into machine code Temporarily executes high-level languages, one statement at a time Translates low-level assembly code into machine code
An executable file of machine code is produced (object code) No executable file of machine code is produced (no object code) An executable file of machine code is produced (object code)
Compiled programs no longer need the compiler Interpreted programs cannot be used without the interpreter Assembled programs no longer need the assembler
Error report produced once entire program is compiled.  These errors may cause your program to crash Error message produced immediately (and program stops at that point) One low-level language statement is usually translated into one machine code instruction
Compiling may be slow, but the resulting program code will run quick (directly on the processor) Interpreted code is run through the interpreter (IDE), so it may be slow, e.g. to execute program loops
One high-level language statement may be several lines of machine code when compiled


Topics / Hardware and Software / Translators