The Translator Station
Assemblers, compilers and interpreters at work
Your mission
Computers only run machine instructions, but people write source code. Visit the three translation lines of the station, change programs after they are built, help the assembler find its labels, and work out which tool each job needs.
Explore
Press the purple button on each line to watch a program being translated, and tap any box to find out more.
Assembly language for the Little Man Computer
Compiled language C++
Interpreted language Python
People write programs in languages they can read. Processors only execute machine instructions. Welcome to the Translator Station, where software tools bridge the gap. Press the purple button on each line to watch a program being translated, and tap any box to find out more.
0 of 7 discoveries made
Experiment
Change compiled and interpreted programs after you build them, run an executable again and again, and let the assembler resolve a label.
No executable yet
No build step: the runtime reads the source each time.
A label is a name for a mailbox. Here VALUE names the mailbox that holds 42. The assembler works out which mailbox that is, then puts its address into every instruction that uses it.
Symbol table
The assembler fills this in during pass 1.
Translator experiments
Try each one. They tick themselves off.
0 of 6 experiments done
Challenge
Six jobs at the station: choose the right translator, order a build, sort compilers from interpreters and resolve a label.
Station manual
- Assembler: assembly mnemonics → machine code
- Compiler: source → object code; linker → executable
- Compiled: change the source → build again
- Interpreter: runs the program through a runtime
- CPython: source → bytecode → Python virtual machine
Finish all 6 jobs to finish this stage.
Understand
Here is what the station was showing you, in the words you need for the exam.
Why do programming languages need translators?
Humans write readable programs, often in languages very different from the processor's machine language. But the processor only understands machine instructions. So a program needs an appropriate translation or execution environment, and different language implementations use different techniques: assemblers, compilers and interpreters.
Key takeaway: programming languages need translators because computers do not directly understand most human-readable source code.
Assembler
An assembler translates assembly instructions into machine code for a specific target. It translates each mnemonic (LDA, ADD, STO) into its instruction code, resolves symbolic labels by replacing them with the correct memory addresses, and produces code the processor (or an educational machine like the LMC) can execute.
Example: LDA 20 → 520. With a label: if VALUE is in mailbox 20, LDA VALUE also becomes 520.
Compiler and linker
A compiler translates source code into another representation, often native machine code or object code. The linker combines object files (with libraries) into an executable program.
The executable can then be run many times without recompiling. When the source code changes, a new build is generally needed to include the change.
Interpreter and runtime
An interpreter executes a program through a software runtime: the runtime reads and processes the program's instructions. Some interpreters first convert source code into an intermediate representation.
A common example is Python with the CPython runtime: it usually compiles Python source into bytecode, which the Python virtual machine executes. So interpreters do not always translate each source line directly into machine code.
A mixed approach: Java
Java source code is compiled into bytecode, and the JVM can interpret it and/or compile it into native instructions.
Important: compilation and interpretation are implementation techniques, not absolute categories of programming languages. Both approaches run programs, but they do so in different ways.
Compiler vs interpreter
| Aspect | Native compilation | Interpretation / runtime execution |
|---|---|---|
| Typical input | Source code | Source or intermediate code |
| Main mechanism | Build executable code ahead of running | Execute through a runtime |
| Example | Native C++ application | Python program under CPython |
| After changing the source | Usually rebuild | Usually run the updated source again |
Words to know
- Source code
- The human-readable program, written in a programming language.
- Assembler
- Translates assembly mnemonics into machine code and resolves labels.
- Compiler
- Translates source code into object code or native machine code before the program runs.
- Object code
- The compiler's output (.o files), not yet a complete program.
- Linker
- Combines object files and libraries into an executable program.
- Executable
- A program that can be run many times without recompiling.
- Interpreter
- Executes a program through a software runtime.
- Bytecode
- An intermediate representation, executed by a virtual machine (Python, Java).
Exam tip
Match each tool to its input: assembler ← assembly language, compiler ← high-level source (ahead of running, then a linker makes an executable), interpreter ← source executed through a runtime. If a question asks what happens after the source changes: compiled programs are usually rebuilt, interpreted programs are usually just run again. And avoid saying "Python is never compiled": CPython compiles to bytecode first.