top of page

10.1: Translators

Exam Board:

Eduqas / WJEC

Specification:

2020 + 

What is a translator?

A translator changes (translates) a program written in one language into another language (usually machine code).

 

There are three types of translator:

Assembler

An assembler converts low level assembly language into machine code.

INP STA 33 INP STA 34

LDA 33 ADD OUT HLT

Interpreter

An interpreter converts high-level language one line at a time into machine code and executes it.

PYTHON

Compiler

A compiler converts high-level language into machine code for execution at a later time. The entire program is converted at once

PYTHON

0010 1011 0101 0101 0110 0111 0101 0001 0101 0101

0010 1011 0101 0101 0110 0111 0101 0001 0101 0101

0010 1011 0101 0101 0110 0111 0101 0001 0101 0101

Differences between an interpreter and a Compiler:

Interpreter

Compiler

  • Execution Method:

    • An interpreter translates source code (high level code) into machine code one line at a time.

​

  • Execution Speed:

    • An interpreter is slower than a compiler because the code must be reinterpreted each time the program is run.

​

  • Complexity:

    • Interpreters are smaller, simpler programs.

​

  • Error Reporting:

    • In error reporting, the interpreter would encounter the errors and report it to the user immediately and stops the program from running.​

​

  • Repetition:

    • Interpreted programs can be edited and run without translating the whole program.

    • Interpreters must reinterpret the program every time it is run.

  • Execution Method:

    • A compiler translates all the source code (high level code) into machine code in one go.

    • A compiler produces an executable file that will run on other machines without the compiler needing to be installed.

​

  • Execution Speed:

    • Compilers can produce much more efficient code than interpreters making the compiled programs run faster.

​

  • Complexity:

    • Compilers tend to be large complex programs.

​​

  • Error Reporting: 

    • The compiler would analyse the entire program, taking note of where errors have occurred and record them in an error file.

​

  • Repetition:

    • Compilation requires analysis and the generation of the code only once, whereas interpreters must re-interpret each time.

    • However, compiled programs have to be re-compiled after any changes have been made.

x1

x1

Monochrome on Transparent.png

Questo's Questions

10.1 - Translators:

​

1. Briefly describe each type of translator: 

  • a. Assembler [1]

  • b. Interpreter [2]

  • c. Compiler [2]

​

2. Compare interpreters and compilers for each of the following features:

  • a. Execution Method

  • b. Execution Speed

  • c. Complexity

  • d. Error Reporting

  • e. Repetition           [10 total]

bottom of page