Translators: Compilers, Interpreters and Assemblers
Revise Translators: Compilers, Interpreters and Assemblers for GCSE Computer Science with this free worksheet and full mark scheme — Foundation and Higher exam-style questions with worked answers. All high-level and assembly code must be translated before a processor can run it.
Free downloads
These worksheets and mark schemes are original, written for Virtus Academy and checked against the current AQA specification. Every worksheet comes with a full mark scheme.
Topic overview
A translator converts program code into machine code so the processor can execute it. Three types must be known.
A compiler translates the entire program into machine code in one go, producing an executable file. Translation happens once, so the program runs quickly afterwards and the source code need not be distributed. But all errors are reported together at the end, which can be discouraging.
An interpreter translates and executes one line at a time. Errors are reported as each is reached, making debugging easier, but the program runs more slowly because translation happens every time it runs. An assembler translates assembly language into machine code, with one assembly instruction usually becoming one machine code instruction.
Revision notes
Compilers
Translate the whole program at once, producing an executable file.
Translation happens once, so execution is fast afterwards. The source code does not need to be distributed. All errors are reported together at the end of compilation.
Interpreters
Translate and execute one line at a time.
Errors are reported as each line is reached, which makes debugging easier. But the program runs more slowly, because translation happens every time it is run rather than once.
Assemblers
Translate assembly language into machine code.
Because one assembly instruction usually corresponds to one machine code instruction, the translation is direct and straightforward compared with compiling a high-level language.
Key points
- A translator converts code into machine code.
- A compiler translates the whole program at once.
- Compiled programs run quickly.
- An interpreter translates one line at a time.
- Interpreters make debugging easier.
- An assembler translates assembly language.
Worked examples
Example 1
State two differences between a compiler and an interpreter. [2 marks]
Working
Example 2
Explain one advantage of using an interpreter when developing a program. [2 marks]
Working
Example 3
State what an assembler translates and what it produces. [2 marks]
Working
Common mistakes
Saying a compiler translates line by line.
That is an interpreter.
Saying interpreted programs run faster.
They run more slowly, because translation happens every run.
Confusing an assembler with a compiler.
An assembler handles assembly language specifically.
Forgetting that compiled code needs no source distribution.
This is a standard advantage.
Exam tips
- Learn the compiler and interpreter differences as a pair.
- Link interpreters to easier debugging.
- Link compilers to faster execution.
- Remember assemblers work on assembly language only.
Key terms
- Translator
- Software converting code into machine code.
- Compiler
- A translator converting the whole program at once.
- Interpreter
- A translator working one line at a time.
- Assembler
- A translator for assembly language.
Related topics
Written and reviewed against the current AQA specification. Spotted an error? Let us know.