Cambridge A-Level Computer Science 9618 – 5.2 Language Translators
5.2 Language Translators
Learning Objective
Show awareness that high‑level language programs may be partially compiled and partially interpreted, such as Java in console mode.
Key Concepts
Compiler – Translates the whole source program into target code (usually machine code) before execution.
Interpreter – Executes a program by translating each statement (or small block) on the fly.
Hybrid (partial compilation + interpretation) – Source code is first compiled into an intermediate form, which is then interpreted or further compiled at run‑time.
Why Use a Hybrid Approach?
A hybrid approach tries to combine the speed of compiled code with the flexibility of interpreted code. Typical benefits include:
Platform independence – the intermediate code can run on any system that provides the appropriate runtime.
Faster start‑up than pure interpretation because some work is done ahead of time.
Dynamic features (reflection, runtime class loading) remain possible.
Java in Console Mode – A Case Study
When a Java program is executed from the command line, the following steps occur: