GCSE · Computer Science · AQA · Spec 8525
Need for translation
Your CPU can't read Python. It can only run machine code, so something has to translate first. Three translators do it, and they don't work the same way.
Computer Science · Structure
Every route ends at machine code
Tap any box to see what it is and why it matters.
Tap any part of the diagram to see what it does.
Predict, then check
Commit to an answer first. Then see what the translator really does.
How many machine code instructions can ONE line of high-level code be translated into?
Computer Science · An invented example
One wrong instruction, run exactly as written
This short program is made up for the lesson. The programmer wants the total cost of two items. Step through it and watch what the computer does.
Before you step through: what will this program output?
1 price1 = 52 price2 = 33 total = price1 - price24 OUTPUT total
| price1 | price2 | total |
|---|---|---|
| 5 |
Output
Step 1: price1 is set to 5.
Step through the trace — every value is the lesson’s, not run by the page.
WHAT YOU'VE LEARNED
A quick recap of today's lesson.
Why a CPU can't run the code you write, and the three translators that fix that
What you need to know
- The CPU can only run machine code, which is 1s and 0s, and different CPUs have different machine code instructions.
- A high-level language such as Python is human-readable. Assembly language uses short mnemonics that stand for machine code instructions.
- Neither is machine code, so the computer can't run them directly. They have to be translated into machine code first.
Have a goPriya types print('hi') and says, 'My CPU just reads that straight off the screen.' What has she missed?
Her line has to be translated into machine code first.
Python is high-level, not machine code, and a CPU can only run machine code.
- That's the need for translation: code that's easier to read, write and debug than binary only works because a translator converts it.
- An assembler translates assembly language into machine code, and usually one assembly instruction becomes one machine code instruction.
- A compiler translates a whole high-level program at once and makes an executable file, so there's no re-translating each time it runs.
Have a goPredict: someone compiles a program on Monday and runs the executable file again on Friday. Is the program translated again on Friday?
No. The executable file already exists.
A compiler translates the whole program once and creates an executable file, so later runs don't repeat the translation.
- An interpreter translates and runs high-level code one line at a time. It makes no executable file, so you need it every run.
- One line of high-level code can become many machine code instructions, with no fixed number.
- The computer runs instructions exactly as written, so an incorrect instruction still runs as written.
Have a goA programmer types the instruction PRINT 'Helo' by mistake. Does the computer quietly fix the spelling before it runs?
No. It runs it exactly as written.
The computer doesn't guess what the programmer meant, so an incorrect instruction is still run as written.
The big picture
A CPU can only run machine code. Code written in a high-level language or in assembly language isn't machine code, so it must be translated first. An assembler translates assembly language. A compiler and an interpreter translate high-level languages in different ways. Whatever the translator produces, the computer then runs it exactly as written.
Key points
Worked example
Problem
Two programmers each need a translator. Programmer A has written a program in assembly language. Programmer B has written a Python program that must be run again and again without being translated each time. Which translator should each use?
⚠ Watch out
Thinking the computer reads your program the way you do and works out what you meant. It doesn't. The CPU runs only machine code, so the code has to be translated first. Then the computer runs the instructions exactly as written, mistakes included.
Memory hook
Picture three human translators at a meeting. The assembler handles one specific language. The compiler translates the whole speech in advance and hands over a written copy. The interpreter translates live, line by line, so must be there every time.
Check yourself
Without looking back: which translator turns assembly language into machine code, and which of the other two is needed every time a program runs?
Flashcards
(13)What type of program can a CPU run?
Do different CPUs use the same machine code instructions?
What is a high-level language?
What is assembly language?
What is the 'need for translation'?
Why do high-level languages only exist because of translators?
What does an assembler do?
What is the usual relationship between assembly and machine code instructions?
How does a compiler translate a program?
What does a compiler create?
How does an interpreter translate a program?
Does an interpreter create an executable file?
How many machine code instructions can one high-level line become?
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 24 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.