High-level Languages · Compilation · Interpretation · Advantages and Disadvantages
CSZoneAQA GCSE Computer Science 8525
Why Translators are Needed
From Source Code to Machine Code
CPUs only understand machine code (binary: 0s and 1s). Programmers write in high-level languages (Python, Java, C++) which are human-readable. A translator converts source code into machine code so the CPU can execute it.
High-level → easier to write and read, portable, abstracted from hardware
Machine code → CPU-specific, fastest execution, unreadable by humans
Compiler vs Interpreter
Two Different Approaches
COMPILER
Translates the entire program before execution. Produces a standalone executable. Errors reported after full scan. Faster at runtime.
INTERPRETER
Translates and executes one line at a time. No separate executable. Stops at first error. Slower at runtime. Useful for development.
Examples:Compiler: C, C++. Interpreter: Python. Java uses both (compiles to bytecode then JVM interprets).
Comparing in Detail
Advantages and Disadvantages
Compiler advantage: runs faster once compiled — no re-translation at runtime
Compiler disadvantage: whole program must compile before errors are shown; takes time to compile
Interpreter advantage: errors shown line by line — easier to debug during development
Interpreter disadvantage: slower to run; source code must be present every time
Exam Practice
Have a go at this question
AQA-style question
Explain one advantage of using a compiler rather than an interpreter to translate a high-level language program.
2 marks
A compiler produces a standalone executable file [1] which runs faster because there is no need to re-translate the code every time the program runs [1].