GCSE · Computer Science · AQA · Spec 8525

Interpreter

Your CPU can't execute a single word of the code you write. So when you press Run, who's translating it, and why do they start all over again next time?

Watch it work

An interpreter, one line at a time

The CPU can only execute machine code. This three-line program is written in a high-level language, so an interpreter has to translate it. Step through two runs of the program and watch what the interpreter does.

Predict first: on the second run, will the interpreter need to translate line 1 again?

1 score ← 0
2 score ← score + 5
3 OUTPUT score
RunLineInterpreterResult
1st1translatesmachine code for line 1

Output

 

Step 1: Run 1 starts. No waiting around: the interpreter goes straight to line 1 and translates just that one line into machine code.

1 / 14

Press Next to move one step. Watch the highlighted line of code and the new row in the table.

Step 1 of 14: Run 1 starts. No waiting around: the interpreter goes straight to line 1 and translates just that one line into machine code..

Watch out: Don't picture the interpreter making a file you keep and run later. It typically creates no executable file, which is exactly why it's needed every time the code runs.

Predict, then check

Jay's line is high-level code, so it is translated into machine code before the CPU executes it.

Jay wants his game to say Good morning. He types OUTPUT "Good mornign" and the program is translated with no problems. What appears when that line runs?

Interpreter vs compiler

InterpretervsCompiler

Same job: translating high-level code into machine code. Very different ways of doing it.

Focus

How it translates

Interpreter

One line at a time, running each line as the program runs

Compiler

The whole program, all at once

The insight

This is the difference people mix up most. Line by line, as it runs, is the interpreter's signature.

What it creates

Interpreter

Typically no executable file

Compiler

A single executable file

Running it again

Interpreter

Needed every time the code runs, including by anyone you share it with

Compiler

The executable can be run without the original code

Getting started

Interpreter

Quick to start

Compiler

Creating the executable can take some time

Each run after that

Interpreter

Translates as it goes, on every run

Compiler

Once the executable exists, the program tends to be quicker to run each time

UK note

AQA GCSE Computer Science (8525): interpreters and compilers sit in specification section 3.4.4, Classification of programming languages and translators.

What do you really think?

Four claims, one of them right

Four things you might hear someone say about programming languages and interpreters.

Which one is closest to the truth?
How sure are you?

Where the interpreter lives

Who does what in an IDE?

Pick a job, then pick the tool in the IDE that does it.

Still to sort

Code editor (0)

Where the code gets written

Compiler or interpreter (0)

Converts the code into a program that runs

Debugger (0)

Helps find and fix errors

Where the line is: Writing code is the editor's job. The debugger is the tool whose job is helping you find and fix errors in it.

5 of 5 still to sort.

An integrated development environment (IDE) is an application that combines multiple coding tools.

Watch out: An IDE can include an interpreter, but the IDE isn't the interpreter. It's the application that brings the tools together.

WHAT YOU'VE LEARNED

A quick recap of today's lesson.

Your CPU can't execute the high-level code you write. Watch an interpreter translate it one line at a time, and find out why it has to do it all again on every run.

What you need to know

  • A computer runs instructions exactly as written. It can't guess what you meant, even when a line is wrong.
  • Have a goYour code should double 8, but you typed OUTPUT 8 + 2. Your friend shrugs: 'Relax, it'll know what you meant.' What actually appears?

    10.

    The computer runs the line exactly as written and can't guess that you meant 8 × 2, so your friend's confidence is misplaced.

  • Machine code is binary, 0s and 1s: the lowest-level language, and the one a CPU executes directly.
  • Different CPUs have different machine code instructions.
  • High-level languages use words and commands closer to human language, and hide the complex hardware details.
  • Low-level languages sit close to machine code and give direct control over the hardware.
  • Compilers and interpreters are translators: they turn high-level code into machine code. Without them, you'd have to write machine code.
  • An interpreter translates one line, runs it, then moves to the next, all while the program runs.
  • Have a goAn interpreter is running a 6-line program with no loops. It has just run line 3. Has line 5 been translated yet?

    No, not yet.

    An interpreter translates each line as the program reaches it, then runs it. 'Yes' assumes the whole program was translated up front, which is what a compiler does.

  • It typically creates no executable file, so the interpreter is needed every time the code runs.
  • A compiler translates the whole program at once into a single executable that runs without the original code.
  • An IDE is one application combining coding tools, such as an editor, a compiler or interpreter, and a debugger.
  • Have a goMo says: 'My IDE is just somewhere to type code.' Name one other tool his IDE could include.

    A debugger, or a compiler or interpreter.

    An IDE can combine several coding tools; Mo is only describing the code editor.

The big picture

A CPU can only execute machine code directly, and a computer runs every instruction exactly as written. High-level languages use words and commands closer to human language, so they must be translated. An interpreter translates and runs a program one line at a time as it runs, typically creates no executable file, and so is needed every time the code runs. A compiler translates the whole program at once into an executable. An IDE can combine an editor, a compiler or interpreter, and a debugger.

Key points

1A CPU executes machine code directly, so high-level code has to be translated first.
2Computers run instructions exactly as written, so instructions need to be precise.
3Interpreter: translates and runs the code one line at a time as the program runs.
4An interpreter typically creates no executable file, so it's needed every time the code runs.
5Compiler: the whole program at once, into an executable that runs without the original code.
6An IDE can combine a code editor, a compiler or interpreter, and a debugger.

Worked example

Problem

Zara's quiz program runs through an interpreter on her laptop. Her friend Ben says: 'Just run it once and send me the file the interpreter made. Then I won't need an interpreter.' What's wrong with Ben's plan, and what will he actually need?

⚠ Watch out

Thinking an interpreter makes an executable file you can keep, like a compiler does. It typically doesn't: it translates and runs the code line by line as the program runs, which is exactly why it's needed every time the code runs.

🧠

Memory hook

Think of a recipe. A compiler translates the whole recipe once and hands you a copy to keep. An interpreter reads it out to you line by line, and has to do it again every time you cook.

✓

Check yourself

Cover the page. In three short steps, explain what an interpreter does with a program. Then add one sentence on why it's needed every time the code runs.

Flashcards

(14)
What does a computer do with an instruction that's wrong?
Runs it exactly as written. It can't guess what you meant.
What is machine code?
The lowest-level language: binary instructions (0s and 1s) that the CPU can execute directly.
Is machine code the same for every CPU?
No. Different CPUs have different machine code instructions.
Two features of a high-level language
Words and commands closer to human language (more readable), and the complex hardware details are hidden.
What is a low-level language like?
Close to machine code, giving direct control over the hardware.
How many lines of machine code can one line of high-level code become?
It can become many lines. There's no fixed number.
What do translators do? Name two kinds.
They translate high-level code into machine code the computer can execute. Compilers and interpreters.
Without translators, how would you have to program?
You'd have to write in machine code.
Interpreter: when does each line of code get translated?
As the program reaches it, just before that line is run. One line at a time.
Why must the interpreter be there for every run of a program?
It typically leaves no executable behind to run instead.
How does a compiler translate a program?
All at once, creating a single executable file that can be run without the original code.
Interpreter vs compiler: the general speed trade-off
An interpreter is quick to start. Compiling takes time, but the executable tends to be quicker to run each time.
You share interpreted code with a friend. What do they need?
An interpreter, since it's needed whenever the code runs, including by anyone it's shared with.
What is an IDE?
An application combining coding tools, which can include a code editor, a compiler or interpreter, and a debugger.

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 posted

More AQA GCSE Computer Science topics

See the full AQA Computer Science curriculum →

How this lesson was checked. This AQA GCSE Computer Science (specification 8525)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 4 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.