OCR · GCSE · Computer Science
Course version: J277 · Version from Sept 2022
Languages: The characteristics of a compiler and an interpreter
A compiler translates a whole high-level program into machine code before any of it runs, producing an executable file that can be distributed and run later without the translator.
Checked against the OCR J277 specification on .
- Point 3 of 3
- 4 key terms
Study notes
From the checked teaching notes for this specification point.
The idea
A compiler translates a whole high-level program into machine code before any of it runs, producing an executable file that can be distributed and run later without the translator. An interpreter translates and executes the source one statement at a time, so it stops at the first error it meets and reports it immediately. Compilers therefore give fast execution but slow development, because each change needs a full recompile; interpreters give slower execution but allow quick testing and easier debugging. For example, a Python interpreter runs a script line by line, while a C compiler builds an .exe. A student should compare both tools on speed of execution, speed of development, error reporting and portability.
What earns the marks
- A compiler translates the entire source program into machine code in one go, producing an executable file that can be run without the translator present.
- An interpreter translates and executes the source program one statement at a time, so translation and execution are interleaved.
- A compiler reports all errors together after compilation, whereas an interpreter stops and reports the first error it encounters.
- Compiled code generally executes faster than interpreted code because translation has already happened.
- Interpreted code is generally quicker to develop and test because a program can be run immediately after editing, without a compile step.
- A compiled executable is platform-specific and must be recompiled for a different processor or operating system, while interpreted source can often run on any machine with a suitable interpreter.
Common mistakes and how to put them right
Saying a compiler 'runs' the program.
Put it right: Describe compilation as translation into machine code, then execution of that machine code.
Claiming an interpreter translates the whole program first.
Put it right: Link each translated statement to its immediate execution.
Stating that compiled programs never have errors.
Put it right: Distinguish syntax errors found at translation from logic errors found by testing.
Exam tips
- Use a comparison table with rows for translation method, execution speed, development speed and error reporting to keep the answer structured.
- Name a concrete example, such as a C compiler producing an executable or a Python interpreter running a script, to make each characteristic clear.
- When asked to recommend one tool, justify the choice using the context given, for example fast execution for a released game versus quick testing during development.
Try the lesson
The start of the Languages: The characteristics of a compiler and an interpreter lesson, made from checked teaching notes for this specification point.
Have a go first
Which type of translator converts a high-level program into machine code before the program is run?
Listen
A compiler translates a whole high-level program into machine code before any of it runs, producing an executable file that can be distributed and run later without the translator. An interpreter translates and executes the source one statement at a time, so it stops at the first error it meets and reports it immediately. Compilers therefore give fast execution but slow development, because each change needs a full recompile; interpreters give slower execution but allow quick testing and easier debugging. For example, a Python interpreter runs a script line by line, while a C compiler builds an .exe. A student should compare both tools on speed of execution, speed of development, error reporting and portability. A strong answer earns marks for these points. A compiler translates the entire source program into machine code in one go, producing an executable file that can be run without the translator present. An interpreter translates and executes the source program one statement at a time, so translation and execution are interleaved. A compiler reports all errors together after compilation, whereas an interpreter stops and reports the first error it encounters. Compiled code generally executes faster than interpreted code because translation has already happened. A common slip: Saying a compiler 'runs' the program: the compiler only translates; the resulting executable is run separately. Instead, describe compilation as translation into machine code, then execution of that machine code. Exam tip: Use a comparison table with rows for translation method, execution speed, development speed and error reporting to keep the answer structured.
See it
Key words
Say what each word means before you turn the card.
Compiler
Try answering aloud or in your head before turning the card.
Interpreter
Try answering aloud or in your head before turning the card.
Execution speed versus development speed
Try answering aloud or in your head before turning the card.
Error reporting and debugging
Try answering aloud or in your head before turning the card.
See every definition
- Compiler
- Translates a whole high-level program into machine code before any of it runs, producing an executable file that can be distributed and run later without the translator.
- Interpreter
- Translates and executes the source one statement at a time, so it stops at the first error it meets and reports it immediately.
- Execution speed versus development speed
- Compilers give fast execution but slow development because each change needs a full recompile, while interpreters give slower execution but allow quick testing.
- Error reporting and debugging
- A compiler reports all errors together after compilation, whereas an interpreter stops and reports the first error it encounters, making debugging easier.
Label the diagram
Some boxes have lost their names. Pick the right name for each number.
1Box 1
2Box 2
3Box 3
There is more to this lesson
The full lesson goes on to check your understanding and help you earn the marks. Create a free account to carry on, with your progress saved.
A week of Premium from your first lesson · Then the free plan continues · No card, no charge
Test your understanding of Languages: The characteristics of a compiler and an interpreter
Active recall beats re-reading. Take an instant quiz now to test what you’ve learned and lock it into long-term memory.
A week of Premium from your first lesson · Then the free plan continues · No card, no charge