Topics / Software / Translators

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

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.

If you need to learn more about high-level languages, visit our Languages page.

Interpreter

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.

If you need to learn more about high-level languages, visit our Languages page.

Assembler

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.

If you need to learn more about low-level languages, visit our Languages page.

Summary of translators

CompilerInterpreterAssembler
Translates high-level languages into machine codeTemporarily executes high-level languages, one statement at a timeTranslates 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 compilerInterpreted programs cannot be used without the interpreterAssembled programs no longer need the assembler
Error report produced once entire program is compiled.  These errors may cause your program to crashError 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 / Software / Translators

Popular Downloads