Compilers, interpreters and assemblers
CIE A-Level Computer ScienceΒ· Unit 5: System Software, Topic 3Β· 20 min read
1. 1. Assemblers: Function and Key Propertiesβ β ββββ± 5 min
Assembler
A translator that converts low-level assembly language source code into processor-specific machine code. Each assembly instruction maps to exactly one machine code instruction for the target processor.
Example:
An ARM assembler converts ARM assembly mnemonics into binary machine code that runs natively on ARM processors.
Assembly language uses human-readable mnemonics (abbreviations) for machine instructions and symbolic labels for memory locations. Assemblers resolve these symbols into actual binary memory addresses during translation.
Explain why an assembler is required to run an assembly program on a Raspberry Pi.
- 1
The Raspberry Pi's ARM processor can only execute binary machine code, not human-readable assembly mnemonics.
- 2
The assembler translates each assembly instruction into its corresponding binary machine code, and resolves any symbolic labels to actual memory addresses.
- 3
The output is a fully executable binary file that can be loaded and run directly on the Raspberry Pi's processor.
Exam tip:
Always mention that 1 assembly instruction maps to 1 machine code instruction when describing assemblers β this is a common marking point.
2. 2. Compilers: Function, Advantages and Disadvantagesβ β β βββ± 7 min
Compiler
A translator that converts an entire high-level source code program into standalone executable machine code (or object code) in one full pass before execution. The original source code is not required to run the compiled output.
Example:
A C compiler converts all .c source files into a standalone .exe executable that runs natively on Windows.
Compilers perform multiple stages of translation including lexical analysis, syntax checking, semantic analysis, code generation and optimization. The optimized executable can be distributed to end users who do not have the compiler installed.
A developer wants to distribute a desktop app to 100,000 users who have no programming tools installed. Explain why a compiler is the right choice here.
- 1
Compilers produce standalone executable files that do not require the original source code or any programming tools to run on a user's device.
- 2
Compiled code runs directly on the processor, so it is much faster than code run via an interpreter.
- 3
Compilers can optimize the code during translation to produce a smaller, faster app, which improves the end user experience.
3. 3. Interpreters: Function, Advantages and Comparisonβ β β βββ± 8 min
Interpreter
A translator that reads and executes source code line-by-line during execution, rather than translating the entire program upfront. No standalone executable is produced, so the interpreter is required to run the program every time.
Example:
Python and JavaScript are commonly run via interpreters during development and for web applications.
Interpreters stop execution as soon as they encounter an error on a line, which makes it easy to identify and fix issues quickly. No full retranslation is required after small changes, so this speeds up development and testing.
A beginner programmer testing small Python snippets while learning uses an interpreter. Explain why this is suitable.
- 1
Interpreters allow code to be run immediately, with no upfront full compilation step after every change.
- 2
If an error exists in one line, the interpreter stops at that line, making it easy for the beginner to find and fix the mistake quickly.
- 3
No compilation wait time means the programmer can test ideas and learn much faster than with a compiled workflow.
Feature | Compiler | Interpreter | Assembler |
|---|---|---|---|
Translation timing | Full translation before execution | Line-by-line during execution | Full translation before execution |
Output | Standalone executable | No standalone executable | Executable machine code |
Execution speed | Fast | Slow | Very fast |
Error reporting | All errors reported after translation | Stops at first error encountered | Errors reported after assembly |
Primary use case | Distributed end-user applications | Development, teaching, scripting | Low-level system programming |
4. Common Pitfalls
Wrong move:
Claiming interpreters translate all source code to machine code upfront before execution.
Why:
This confuses compilers and interpreters. Upfront full translation is the defining feature of a compiler.
Correct move:
State that interpreters translate and execute source code one line at a time during execution, with no upfront full translation.
Wrong move:
Claiming assemblers translate high-level language to machine code.
Why:
Assemblers only translate low-level assembly language, not high-level source code.
Correct move:
State that assemblers convert low-level assembly language to processor-specific machine code, with one assembly instruction mapping to one machine code instruction.
Wrong move:
Claiming all compiled code is tied to a single processor architecture.
Why:
This is only true for natively compiled machine code. Compiled intermediate bytecode (like Java bytecode) can run on any architecture with a suitable runtime.
Correct move:
Specify that natively compiled machine code is architecture-specific, while compiled intermediate code is cross-platform.
Wrong move:
Confusing assembler output with compiler output.
Why:
Both produce machine code, but they take different types of input, which is the key distinction examiners look for.
Correct move:
Always state the input type for each translator: assembler β assembly language, compiler β high-level source code.
5. Quick Reference Cheatsheet
Translator | Input | Key Feature | Common Use Case |
|---|---|---|---|
Assembler | Low-level assembly language | 1 instruction β 1 machine code, translated upfront | Low-level firmware, driver development |
Compiler | High-level source code | Full translation upfront, standalone output | Distribution of end-user applications |
Interpreter | High-level source/bytecode | Line-by-line translation during execution | Development, teaching, scripting |
6. Frequently Asked
Do I need to implement a compiler for the exam?
No, CIE 9618 only requires you to describe, compare and explain the function of translators, not implement them.
What is the key difference between an assembler and compiler?
An assembler translates low-level assembly language (one instruction maps to one machine code instruction), while a compiler translates high-level source code (one high-level instruction maps to multiple machine code instructions).
When this came up on past exams
AI-estimated based on syllabus patterns β cross-check with official past papers for accuracy. Use only as revision-focus signals.
- 2022 Β· 12
Compare different translator types
- 2023 Β· 11
Describe the function of an assembler
- 2024 Β· 13
Interpreter vs compiler comparison
Going deeper
What's Next
Understanding translators is a core foundation for all advanced topics in system software and software development for CIE 9618. This knowledge will help you when learning about the individual stages of compilation, how linkers and loaders prepare code for execution, and how software is built for different platforms. You will also rely on these distinctions when answering questions about programming language classifications and system architecture in both Paper 1 and practical assessments.
