Languages & Translators
Understanding the difference between high and low level code, and how we translate it for the processor.
Lesson Objectives
1. Levels of Programming Language
High-Level
Python, Java, C#
Tap to FlipHigh-Level Language
Designed for humans. Uses English keywords like
print and if.
Machine Code
10110010 11001000
Tap to FlipMachine Code
Pure Binary (1s and 0s). The only language the CPU understands.
Examiner's Eye: The "Hex" Trap
Examiners will award zero marks if you state that machine code is written in Hexadecimal. Machine code is strictly binary (1s and 0s). Hexadecimal is only used by humans as a shorthand to make binary easier to read on screen.
2. Translators
Processors only understand Machine Code (Binary). Therefore, high-level code and assembly language must be translated before they can be run.
Examiner's Eye: The Purpose Trap
When asked why a translator is needed, writing "so the computer can understand it" is too weak and scores zero marks. To guarantee the mark, you must be highly specific: "To convert high-level source code into machine code/binary so the CPU can execute it."
| Feature | Compiler | Interpreter |
|---|---|---|
| Translation Method | ? | ? |
| Executable File | ? | ? |
| Error Reporting | ? | ? |
| Distribution | ? | ? |
Click the '?' boxes to reveal the answers
Examiner's Eye: The Speed Misconception
Do not just write "A compiler is faster". This is ambiguous! You must specify that a compiler creates an executable that executes faster, but the initial translation process actually takes longer than an interpreter.
Interactive Lab: See it in action
Run code through a virtual Compiler and Interpreter to see the difference.
Open Translator LabStretch & Challenge
"Sarah is a freelance software developer who has written a new video game in Python. She wishes to distribute it for sale on a digital storefront online. Evaluate whether she should use a compiler or an interpreter to prepare her software for distribution." [8 marks]
View Examiner Model Answer
Sarah should definitively use a compiler for distribution.
Compilers translate the entire source code into a standalone executable file (.exe) which can be given directly to customers. This means her customers will not need to forcefully install the Python interpreter software just to play her game.
Crucially, compiling the code converts it strictly to machine code, which hides the original source code. This protects Sarah's intellectual property, preventing rival developers from seeing, stealing, or modifying her original code.
Finally, compiled software generally executes much faster as it is already fully translated into processor-ready binary, providing a smoother gaming experience, even though her initial compilation process back in her studio may take longer than interpreting.