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 · Translators

Which translator is which?

Which translator does each statement describe? Tick every translator it describes. Some statements describe more than one, so expect a few to land in the overlaps.

  • A Assembler
  • B Compiler
  • C Interpreter
  1. Is a translator
  2. Translates assembly language
  3. One assembly instruction becomes one machine code instruction (the usual model)
  4. Translates high-level languages
  5. Translates the whole program at once
  6. Creates an executable file
  7. Means the program doesn't need translating again each time it's run
  8. Translates and runs the code one line at a time
  9. Is needed every time the program runs

Computer Science · Structure

Every route ends at machine code

Tap any box to see what it is and why it matters.

runs

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 = 5
2 price2 = 3
3 total = price1 - price2
4 OUTPUT total
price1price2total
5

Output

 

Step 1: price1 is set to 5.

1 / 4

Step through the trace — every value is the lesson’s, not run by the page.

Step 1 of 4: price1 is set to 5..

Watch out: The third line says minus when the programmer meant plus. The computer doesn't stop and think 'surely they meant add'. It runs the instruction as written.

Computer Science · Translators

Write it, then mark it

A programmer has written a program in Python. Explain why it must be translated before it can run, then describe how a compiler and an interpreter would each translate it. [4 marks]

0 words · your answer stays on this page and is not sent anywhere.

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

1Machine code is the only thing a CPU can run, so every other kind of program needs translating first.
2High-level languages and assembly language are for humans. Translators are what let humans use them.
3Three translators, three jobs: the assembler for assembly language, the compiler and the interpreter for high-level languages.
4Compiler: whole program, executable file, no repeat translation. Interpreter: one line at a time, no executable file, needed every run.
5Running exactly as written means mistakes in the code are run too.

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?
Only machine code. It is binary instructions, 1s and 0s, that the computer can execute directly.
Do different CPUs use the same machine code instructions?
No. Different CPUs have different machine code instructions.
What is a high-level language?
A human-readable programming language, such as Python. It isn't machine code, so it must be translated.
What is assembly language?
A language of short, readable mnemonics that stand for machine code instructions. It isn't machine code, so it must be translated.
What is the 'need for translation'?
The computer can only run machine code, but humans write in languages that are easier to read, write and debug. A translator converts one into the other.
Why do high-level languages only exist because of translators?
Without translators, the only option would be to write programs in machine code.
What does an assembler do?
It translates assembly language into machine code.
What is the usual relationship between assembly and machine code instructions?
One-to-one. Each assembly instruction usually translates into one machine code instruction.
How does a compiler translate a program?
It translates the whole program into machine code at once.
What does a compiler create?
An executable file that can be run without the original code, so the program isn't translated again each run.
How does an interpreter translate a program?
It translates and runs the code one line at a time.
Does an interpreter create an executable file?
No, so the interpreter is needed every time the program is run.
How many machine code instructions can one high-level line become?
Many, with no fixed number.

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 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.