GCSE · Computer Science · Eduqas · Spec C500QS
Compilers
You press Run and nothing appears. Not even the first line. The mistake is on the very last line, so why did the whole program refuse to start?
Computer Science · Translators
Press Run, then watch the translator go first
This short program should print three lines and then the total of 4 + 3. Press Run and read what comes back. If something is wrong, choose the fix that makes it work.
In the result, the first line shows the translation finishing. The lines after it are what the program printed once the executable ran.
- print("Welcome to the quiz")
- total = 4 + 3
- print("Adding up...")
- print("Total:")
- print(total
Illustrative: the messages are written for this lesson, not copied from a real compiler. Real translators word their messages differently.
Why a compiler?
Reason it through
Why does a high-level program need a compiler at all?
First link · your turn
Start with the processor. What kind of instructions can it execute?
WHAT YOU'VE LEARNED
A quick recap of today's lesson.
How a whole program gets translated into machine code before it ever runs
What you need to know
- A compiler is a translator: a program that converts program code from one language into another.
- Your processor is fussy. It can only execute machine code, which is binary instructions.
- So a program written in a high-level language must be translated into machine code before it can be executed.
Have a goPicture the processor as someone who only speaks machine code, and your program as a speech in another language. What job does a compiler do here?
It is the translator: it converts the program into machine code for the processor.
The processor can't use your high-level program as written, so a translator has to convert it into the one form it can execute.
- The compiler's job: turn source code in a high-level language into machine code (object code) the processor can execute.
- It translates the whole program in one go, not one statement at a time.
Have a goRavi is very sure that a compiler translates one statement at a time as it goes. He is also wrong. What do you tell him?
It translates the whole program in one go, not one statement at a time.
Translating bit by bit is the tempting picture, but a compiler works through the whole program in one go.
- It does this before the program is run: compile first, then execute the machine code.
- What comes out is a machine-code version of the program, called an executable.
- That executable can be run again and again without being translated again.
Have a goA program is compiled once, then the executable is run 5 times with no edits. How many times has it been translated?
Once.
The executable can be run again and again without being translated again, so extra runs add executions, not translations.
The big picture
A compiler is a translator that converts a whole program written in a high-level language into machine code before the program runs. The processor can only execute machine code, and the executable the compiler produces can be run again and again without being translated again.
Key points
Worked example
Problem
Mia compiles her program and runs it on Monday. On Tuesday she changes one line of the source code. What must she do before the changed program can run, and why can't she just run Monday's executable again?
⚠ Watch out
Thinking the compiler runs the program, or translates it a statement at a time while it runs. It does neither: it translates everything first, and then the processor executes the machine code it made.
Memory hook
Compile first, run after. C comes before R, and in a compiled program the translating comes before the running.
Check yourself
A friend says, "The compiler runs my program." Say what is wrong. Check: it translates the whole program into machine code first; the processor then executes that.
Flashcards
(8)What is a compiler?
What is the only kind of code a processor can execute?
What goes into a compiler, and what comes out?
Does a compiler translate the whole program or one statement at a time?
When does a compiler do its translating?
What is the output of a compiler?
You run an executable a second time. Is it translated again?
What is object code?
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 Eduqas GCSE Computer Science topics
- Characteristics of networks
- Choosing high-level vs low-level
- Clipboard manager
- Cloud storage
- Code optimisation (compilation stage)
- Compilation and interpretation of code
- Compression ratios
- Control unit (CU)
- CPU performance: cache size and levels
- CPU performance: clock speed
- CPU registers
- Cryptographic utilities
How this lesson was checked. This Eduqas GCSE Computer Science (specification C500QS)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 16 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.