Lost in Translation
A processor understands only machine code, yet we write in Python and Java. Meet low-level and high-level languages, and the compilers and interpreters that bridge the gap between people and hardware.
Revise this, the fun way
Play it interactively, earn XP and build a streak, free.
Start revising freeWhat you'll cover
Speaking to a machine 💻
A computer's processor understands only **machine code**: raw binary. Yet we write programs in languages like Python and Java. Something has to **translate** between the two. This module climbs from **low-level** to **high-level** languages, and meets the **compilers** and **interpreters** that bridge the gap.
The language of languages 🔑
Four ideas run through this module:
Low-level and high-level ⚖️
Languages sit on a ladder from the **hardware** up to something close to **English**. The two ends trade off control against readability.
Straight to the processor 🎯
Which of these can a computer's processor run directly, with no translation?
- Machine code
- Python source code
- Assembly language
- Any high-level code
Match each term to what it is 🔗
- Machine code
- Assembly language
- High-level language
- Translator
- Binary that runs directly on the CPU
- Low-level mnemonics such as ADD and MOV
- Human-readable, portable code
- Turns source code into machine code
Why write high-level? ✅
Select the TWO features of a high-level language.
- It is easier for people to read and write
- It can run on different machines once translated
- It runs directly on the CPU without translation
- It is written in binary
Two ways to translate 🔄
A **compiler** translates the **whole** program at once and produces a standalone **executable** file that runs on its own. An **interpreter** translates and runs the program **one line at a time**, producing no executable, so the interpreter must be present every time it runs.
Match each translator to what it does 🔀
- Compiler
- Interpreter
- Assembler
- Executable
- Translates the whole program at once
- Translates one line at a time
- Turns assembly into machine code
- A compiled file that runs on its own
How a compiler works 🪜
An interactive activity.
Who makes an executable? 📦
Which translator produces an executable file that can run on its own?
- A compiler
- An interpreter
- Neither of them
- Both of them equally
Translation in words 🧩
A processor can only run _____ code. We write programs in a _____ language like Python, then a translator converts it. A _____ translates the whole program at once and produces an executable. An _____ translates and runs one line at a time and stops at the first _____.
Spot the true statements 🖍️
An interactive activity.
Pick the right tool 🧭
An interactive activity.
Compiler versus interpreter ✍️
An interactive activity.