GCSE · Computer Science · AQA · Spec 8525
Compiler
You type score = score + 1. Your processor can't run that. It only runs machine code: 1s and 0s. So who does the translating, and when?
Predict, then check
Mia's program translated with no problems. Now it runs.
Mia wants her game to add 10 bonus points. She types: score = score - 10. The score is 50. What happens when this line runs?
Name that level
Which kind of language is this line?
Pick a line, then pick its level. These lines are made-up illustrations, not code for any real processor.
Still to sort
High-level language (0)
Statements a person can read through
Assembly language (0)
Short mnemonics standing in for machine code
Where the line is: More readable than binary, but a mnemonic like ADD is not a high-level statement: assembly is still low-level.
Machine code (0)
Binary: nothing but 1s and 0s
WHAT YOU'VE LEARNED
A quick recap of today's lesson.
Your CPU only runs machine code. Meet the three translators that get your code there, and learn to tell the compiler, the interpreter and the assembler apart for good.
What you need to know
- A CPU can only run machine code directly: binary 1s and 0s, and different CPUs have different instructions.
Have a goA machine code program runs perfectly on Leo's laptop. He copies it onto a computer with a different CPU and says: 'Bound to work, it's all just 1s and 0s.' Safe bet?
No, not a safe bet.
1s and 0s aren't universal: different CPUs have different machine code instructions, so instructions one CPU understands may not mean the same thing to another.
- Computers run instructions exactly as written, with no guessing, so instructions must be precise.
- High-level languages are easier for humans to read and hide the hardware details; one line can become many machine code lines.
- Low-level languages are close to machine code: direct hardware control, harder to read, and programs that tend to run quickly.
- Assembly language is low-level, swapping binary for short, readable mnemonics such as ADD.
- Translators exist so you don't have to write everything in machine code.
- An assembler translates assembly language into machine code, one machine code instruction per assembly instruction.
Have a goAn assembly program is 20 instructions long. How many machine code instructions does the assembler produce?
20.
Each assembly instruction becomes exactly one machine code instruction. 'Many' is something that can happen with high-level code, not assembly.
- A compiler translates a whole high-level program into machine code at once, creating an executable file.
- That executable file can be run without the original code.
- An interpreter translates and runs code line by line, creates no executable, and is needed every time the code runs.
Have a goYou run a high-level program through an interpreter today. Tomorrow you want to run it again. Will you need the interpreter?
Yes, every time.
An interpreter makes no executable file to keep, so the code has to be translated and run line by line again.
The big picture
A CPU only runs machine code directly, and it runs every instruction exactly as written. High-level languages are readable and hide the hardware; low-level languages, including assembly with mnemonics such as ADD, are close to machine code. An assembler translates assembly into machine code, one instruction to one. A compiler translates a whole high-level program at once into an executable that runs without the original code; an interpreter translates and runs it line by line and is needed every time.
Key points
Worked example
Problem
A student writes: 'A compiler and an interpreter both turn high-level code into an executable file. The interpreter just does it line by line.' What's right, what's wrong, and how would you fix it?
⚠ Watch out
Saying an interpreter creates an executable file, or that a compiler works line by line. It's the compiler that translates the whole program at once and creates an executable that runs without the original code. The interpreter translates and runs line by line and is needed every time the code runs.
Memory hook
Compiler = Complete: the whole program once, and you keep the executable. Interpreter = In the moment: line by line, every single run. Assembler = Assembly, one for one.
Check yourself
Cover the page. Write one sentence each for the compiler, the interpreter and the assembler, saying what it translates and how. Then underline the one job two of them share.
Flashcards
(14)What does a compiler do?
How does an interpreter work through code?
What can a compiler's executable file run without?
What is machine code?
Is there one machine code that every CPU shares?
Give two features of high-level languages.
How much machine code can one line of high-level code become?
Why might a programmer pick a low-level language?
What's the downside of low-level languages?
What is assembly language?
What does an assembler do?
Why do we need translators at all?
What does a computer do with an instruction that's wrong?
Which two translators can translate a high-level language?
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 AQA GCSE Computer Science topics
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.