GCSE · Computer Science · OCR · Spec J277
Interpreter
Picture a translator who speaks each sentence the moment it's translated, then waits for the next. Nothing written down. That's an interpreter.
Computer Science · Translators
Watch an interpreter work, one line at a time
A made-up program, four lines. Press Next and watch translating and running take turns.
Before you press Next: which will happen first for line 2, translating it or running it?
1 name = "Ada"2 OUTPUT "Hello " + name3 total = 2 + 34 OUTPUT total
Variables
Output
Step 1: The interpreter translates line 1 only. Lines 2, 3 and 4 haven't been looked at.
Press Next and watch: translate a line, then run it, then the next line.
WHAT YOU'VE LEARNED
A quick recap of today's lesson.
The translator that never finishes translating before it starts running.
What you need to know
- An interpreter is a translator for high-level code.
- It translates and runs the program one line at a time.
- So the rhythm is: translate a line, run it, then move on to the next.
Have a goA made-up program has 3 lines. An interpreter has just finished running line 1. What does it do next, and has line 3 been touched yet?
It translates line 2 (then runs it). Line 3 hasn't been touched.
It handles one line at a time, so line 3 waits until line 2 has been translated and run.
- An interpreter does not produce an executable file.
- That means the interpreter is needed every time the code is run.
Have a goDev says: "I ran my program through an interpreter yesterday, so today I'll just double-click the file it made." Dev is very confident. Is Dev right?
No. An interpreter makes no executable file, so there is no file to double-click.
No executable file is produced, so the interpreter is needed every time the code is run.
- A compiler is also a translator for high-level code.
- A compiler translates the whole program at once.
- Its result is a single executable file.
Have a goMaya compiles a 20-line program. Does she end up with 20 files (one per line) or just one?
Just one: a single executable file.
A compiler translates the whole program at once, and the result is a single executable file, not one per line.
The big picture
An interpreter is a translator for high-level code that translates and runs a program one line at a time, without producing an executable file, so it is needed every time the code is run. A compiler is different: it translates the whole program at once into a single executable file. Both are translators for high-level code.
Key points
Worked example
Problem
A made-up 3-line program is run by an interpreter. Line 1: OUTPUT "Go". Line 2: speed = 4. Line 3: OUTPUT speed * 2. (a) While the interpreter is working on line 2, what has happened to line 1 and to line 3? (b) The program ends. What is left behind, and what is needed to run it again tomorrow?
⚠ Watch out
Assuming an interpreter builds an executable file like a compiler does, so the program can be run again without it. It doesn't: nothing is left behind.
Memory hook
Think of a live interpreter at a conference: translate a sentence, say it, wait for the next, and no written copy left at the end. A compiler is the translator who hands you the whole translated document. (An analogy to remember it by, not the definition.)
Check yourself
Without scrolling back: what does an interpreter do with line 1 before it touches line 2, and what is left behind when the last line has run?
Flashcards
(7)What is an interpreter?
What happens to each line when an interpreter runs a program?
Does an interpreter produce an executable file?
What is a compiler?
What do compilers and interpreters have in common?
Compiler or interpreter: which one translates one line at a time?
Compiler or interpreter: which one ends with a single executable file?
Tap any card to flip it, or use Study as deck to go through them one at a time. In the full lesson these run as a spaced-repetition deck — you rate each card Hard, Good or Easy and the tricky ones keep coming back until they stick.
Learning with Lightbulb is opening soon
You can use this lesson now. Join the waitlist and we'll let you know when the full Lightbulb experience is ready.
Keep me postedMore OCR GCSE Computer Science topics
How this lesson was checked. This OCR GCSE Computer Science (specification J277)lesson was published through Lightbulb Learning's human-designed editorial process — the educational standards, accuracy rules and publication checks it must pass were authored and approved by Philip Halpin. It passed subject-specific assessment, automated educational checks and technical publication verification before going live (publication checks completed 9 November 2026). Published pages are monitored, human spot-checking is ongoing across the lesson library, and anything found wrong is corrected or withdrawn. How our lessons are made and checked. Spotted a mistake? Email hello@lightbulblearning.co and we'll review it.