The big idea: A CPU executes machine code and nothing else. Every high-level language must therefore be translated.
A compiler translates the whole program in advance and produces a file that runs on its own. An interpreter translates and executes line by line, every time the program runs.
| 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 | One at a time, when reached |
| Speed of execution | Faster — already machine code | Slower — translation happens as it runs |
| Needed at run time | Nothing | The interpreter itself |
| Portability | One build per platform | Runs anywhere the interpreter exists |
Free preview
This is the free notes preview
You're reading the free notes. Aimnova Pro unlocks the full study experience — and you can try it with your first topic free to keep:
- FlashcardsLock in vocabulary and key terms with spaced repetition.
- Practice questionsAnswer exam-style questions and get instant AI marking.
- Mock exams & past-paper vaultSit full mocks and see exactly how examiners award marks.
- Personalised study planA daily plan built around your exam date and weak areas.
Compiler wins
- Shipping software — users need no toolchain
- Performance-critical code
- The source is not distributed
- Whole-program optimisation becomes possible
Interpreter wins
- Development — edit, run, see, repeat, with no build step
- Learning and experimenting line by line
- Cross-platform without rebuilding
- Scripts and automation
In practice, both
- Java and Python compile to bytecode, then interpret it
- Portable like an interpreter, faster than pure interpretation
- JIT compiles hot paths to machine code as it runs
Bytecode is the standard compromise: Compile once to an intermediate bytecode, then run it on a virtual machine for the platform in hand.
You get the compiler's error checking and speed, and the interpreter's portability — which is why almost every modern language works this way rather than choosing a side.
Study smarter, not longer
Most students waste 40% of study time on topics they already know. Our AI tracks your progress and optimizes every minute.
The difference that matters in practice
- A compiler checks the whole program first, so every syntax error is reported before it runs at all
- An interpreter finds an error only when execution reaches that line
- So a typo inside a rarely-taken branch can survive months of testing
- And the program will have already done work before it fails partway through
- Neither catches logic errors — both run a wrong answer perfectly happily
Say the consequence, not just the fact: "An interpreter reports errors one at a time" is the fact. "So a fault in an untested branch is not found until a user reaches it, by which point the program has already changed data" is the answer.
How this is tested — you must weigh the two against a stated purpose, and give both sides. It comes up two ways:
Paper 1 Section A
- Evaluate the translation processes, 4-6 marks
- State one advantage of each
- Explain when an error is reported
Paper 1 Section B — case study
- Justify a choice for a described situation
- Explain why most languages use bytecode
The classic trap: Declaring one of them simply better. Evaluate requires both sides and a judgement tied to the purpose — shipping software and learning to program want opposite answers.
The same source down two routes — and where each one finds the typo on line 4.
Interactive diagram
Explore the labelled diagram, charts and maps for this topic in full study mode.
A studio writes a game in a compiled language but its level designers use an interpreted scripting language inside the same game. Evaluate why both are used.
Model answer plan
See the mark-by-mark plan — for / against / judgement, with marking guidance — in study mode.