Key Idea: A processor executes machine code and nothing else, so every high-level language must be translated. The only real question is when — all at once before running, or line by line as it runs — and everything else about compilers and interpreters follows from that.
Paper 1
- Short definitions and one comparison.
- State, outline, describe.
Paper 2
- Justify a choice for a described system.
- Evaluate, suggest, explain.
Both
- Name what the choice gives up, not only what it gains.
⚖️ The comparison
| Compiler | Interpreter | |
|---|---|---|
| Translates | The whole program, once | One line at a time, every run |
| Produces | A standalone executable | Nothing — it runs it directly |
| Errors reported | All at once, before running | When reached |
| Execution speed | Faster | Slower — translating as it goes |
| Needed at run time | Nothing | The interpreter |
| Portability | One build per platform | Anywhere the interpreter exists |
Compile once to an intermediate form, then run it on a virtual machine for the platform in hand. The compiler's checking and speed, with the interpreter's portability — which is why Java and Python both work this way rather than choosing a side.
Important: Both check the language's rules, not your intentions. A program that compiles cleanly and runs to completion can still produce an entirely wrong answer, and nothing will report it.
🐛 When you find out
The difference that actually bites
- A compiler refuses to produce an executable until every syntax error is fixed
- An interpreter reaches a bad line only if execution gets there
- So a typo in a rarely-taken branch — an error handler, a leap year — survives testing
- And when it finally fails, the program has already done work, possibly half-written data
- Which is why a late failure is worse than an early one, not merely later
📝 Exam-style questions
A team is choosing between a compiled and an interpreted language for a tool that will be distributed to schools with locked-down computers. Evaluate the choice.
🔒 Model answer plan
See the mark-by-mark plan — for / against / judgement, with marking guidance — in study mode.
A script has run nightly for eight months and then fails with a syntax error. Explain how this is possible and what it implies about testing.
🔒 Model answer plan
See the mark-by-mark plan — for / against / judgement, with marking guidance — in study mode.
✅ Quick check
Cover the answers.
When does a compiler report syntax errors? Before the program runs at all — the whole source is checked first and every error reported together.
Why is interpreted code slower? Translation happens while it runs, every run. Compiled code was already machine code before it started.
What is bytecode for? Compile once to an intermediate form, then run it on a virtual machine per platform — checking plus portability.
What does an interpreted program need that a compiled one does not? The interpreter itself, present on the machine at run time.
Do either catch logic errors? Neither. They check the language's rules, not your intentions.
Exam tips
- Evaluate needs both sides AND a judgement tied to the purpose.
- Find the constraint in the scenario — deployment, speed, iteration — and answer from it.
- Say the CONSEQUENCE of late error reporting: work already done, data half-written.
- Compiled = one build per platform. Interpreted = needs the interpreter present.
- Bytecode is what most modern languages actually do. Mention it.