Skip to main content
EnglandComputer ScienceSyllabus dot point

What are compilers, interpreters and assemblers, and how do they differ?

The purpose of translators, the characteristics of a compiler and an interpreter and how they differ, and the role of an assembler in translating assembly language.

An OCR J277 2.5.2 answer on translators: why source code must be translated, the characteristics of a compiler and an interpreter and how they differ, and the role of an assembler in translating assembly language to machine code.

Generated by Claude Opus 4.810 min answer

Reviewed by: AI editorial process; not yet individually human-reviewed

Have a quick question? Jump to the Q&A page

Jump to a section
  1. What this dot point is asking
  2. Why translators are needed
  3. Compilers
  4. Interpreters
  5. Assemblers
  6. Try this

What this dot point is asking

OCR wants you to explain why translators are needed, the characteristics of a compiler and an interpreter and how they differ, and the role of an assembler. The most examined point is the compiler-versus-interpreter comparison: whole-program-at-once versus line-by-line. This is examined in Paper 2, often as a comparison.

Why translators are needed

Compilers

Interpreters

Assemblers

Try this

Q1. State what a translator does. [1 mark]

  • Cue. Converts source code into another language, usually the machine code the CPU can execute.

Q2. State the key difference between how a compiler and an interpreter translate a program. [2 marks]

  • Cue. A compiler translates the whole program into machine code in one go before it runs; an interpreter translates and executes it one line at a time, each time it runs.

Q3. State what an assembler translates. [1 mark]

  • Cue. Assembly language into machine code.

Exam-style practice questions

Practice questions written in the style of OCR exam questions on this dot point, with worked answer explainers. The year tag is the paper they imitate, not the source.

OCR 20216 marksCompare a compiler and an interpreter. Your answer should explain how each translates a program and discuss an advantage and disadvantage of each.
Show worked answer →

A 6-mark comparison, so explain each then compare.

Compiler: translates the whole source code into machine code in one go, before the program runs, producing an executable file. Advantages: the program then runs quickly without the translator, and the executable can be distributed without the source code. Disadvantages: compiling takes time before you can run, and errors are reported all together at the end of compilation, which can slow debugging; the executable is specific to one platform.

Interpreter: translates and executes the source code one line (statement) at a time, each time the program runs. Advantages: it runs the code immediately with no separate compile step, and it reports each error as it reaches it, which is helpful while developing. Disadvantages: it runs more slowly because translation happens every time it runs, and the source code (and an interpreter) is needed each time.

Markers reward the whole-at-once versus line-by-line distinction, and a genuine advantage and disadvantage of each, with a clear comparison.

OCR 20223 marksState what a translator is, name the three types, and state what an assembler translates.
Show worked answer →

Translator (1): a program that converts source code written in one language into another language, usually into machine code that the CPU can execute.

Three types (1): compiler, interpreter and assembler.

Assembler (1): it translates assembly language (a low-level language using mnemonics) into machine code, usually one mnemonic to one machine-code instruction.

Markers reward the definition of a translator, the three correct types, and the assembler translating assembly language into machine code. Confusing the assembler with the compiler loses the last mark.

Related dot points

Sources & how we know this