CodeIEB
Theory Notes/🖥️ Topic 1: System Technologies/11.1.6
11.1.6Grade 11

Programming Tools & Language Translators

Every program you write in Java eventually has to become something the CPU can execute. This subtopic is about the tools that make that translation happen, and the trade-offs between different levels of programming language.

Programming languages are broadly classified by how close they are to what the hardware directly understands:

LevelDescriptionExample
Low-level languageClose to machine code; hardware-specific, fast, but hard for humans to read/write and not portable between different CPU typesAssembly language, machine code
High-level languageCloser to human language; easier to read, write, debug and port across platforms, but must be translated before the CPU can run itJava, Python, C#

Language translators convert source code into a form the computer can execute:

Compiler
Translates the entire source code into machine code (or bytecode) all at once, before the program runs, producing an executable file. Errors are reported after the full compilation pass.
One-stage compiler
Translates source code directly into machine code that the CPU can run natively.
Two-stage compiler
Translates source code into an intermediate form (e.g. Java bytecode) first; that intermediate code is then run by a virtual machine (e.g. the JVM), which makes the compiled program portable across different operating systems.
Interpreter
Translates and executes source code line-by-line, without producing a separate executable file. Easier for debugging (stops immediately at the line with an error) but generally slower to run than compiled code.
Assembler
Translates assembly language (a low-level, human-readable representation of machine code) directly into machine code.

Comparing and recommending: compiled programs generally run faster (already translated) but must be recompiled after every change; interpreted programs are slower to run but faster to test/debug during development since there's no separate compilation step.

Example

Java uses a two-stage approach: the Java compiler (javac) compiles your .java source files into .class bytecode files, and then the Java Virtual Machine (JVM) interprets/executes that bytecode at runtime — this is exactly why the same compiled Java program can run on Windows, macOS or Linux without changes.

💡 Exam Tip

If a question asks you to 'recommend' a translator type for a scenario, justify it: choose a compiler when execution speed and a distributable final product matter; choose an interpreter when rapid testing/debugging during development matters most.