Examhaus — Achieve with confidence.

IB Computer Science A1.4: Translation (HL only)

New IB Computer Science syllabus · first exams May 2027 · Theme A · HL only

A CPU can only execute machine code. Every program written in a high-level language, including the Python or Java you write for Paper 2, must be translated before it can run. A1.4 is about how that happens and how to choose the right method.

StatementTopicCommand term
A1.4.1 (HL)Translation processes of interpreters and compilersEvaluate
⚠️ Command term alert: Evaluate is the highest-order command term. Don't just list facts about compilers and interpreters. Weigh the trade-offs and reach a justified conclusion for the scenario you're given.

Key points

Compilers: translate, then run

  • How it works: the whole program is translated into machine code before it runs, producing a standalone executable.
  • Error detection: at compile time. The whole program is checked first, and one syntax error stops compilation.
  • Speed: fast, because the CPU runs native code with no translation while it runs.
  • Portability: low. The executable is built for one CPU and operating system.
  • Development: slower, because you recompile after every change.
  • Typical uses: games, operating systems, shipped software.

Interpreters: translate and run together

  • How it works: the source code is translated and executed one instruction at a time. No executable is produced.
  • Error detection: at run time. A program can run for a while and then crash when it reaches a bad line.
  • Speed: slower. Code inside a loop is translated again every time it runs.
  • Portability: high. The same source code runs anywhere a suitable interpreter is installed.
  • Development: fast, with instant feedback.
  • Typical uses: prototyping, scripting, education, interactive (REPL) environments.

The hybrid path: bytecode and JIT

  • Bytecode: source code is compiled into a platform-independent intermediate form, such as Java .class or Python .pyc files. A virtual machine (the JVM, or CPython's VM) then interprets it. The same bytecode runs on any platform with a compatible VM.
  • Just-in-time (JIT) compilation: the virtual machine compiles frequently run ("hot") sections of bytecode into native machine code while the program runs, and caches the result. That's why long-running Java and JavaScript programs speed up the longer they run.
  • The trade-off: a short warm-up delay, in exchange for portability and close to native speed.

Choosing a method for a scenario

  • Rapid development and testing → interpreter. There's no compile wait, and errors appear as soon as they're reached. Slower execution is acceptable before the software goes live.
  • Performance-critical applications → compiler. Native code with no runtime translation suits games, real-time and embedded systems.
  • Cross-platform development → bytecode and JIT. Compile once into portable bytecode and let each platform's VM run it, avoiding a separate build for every platform.

Exam-style question

Evaluate whether a compiler or an interpreter is more appropriate for developing and testing a new application. [6]

Mark scheme

  • [2] An interpreter is more appropriate for developing and testing.
  • [2] A valid supporting reason:
    • Its fast development cycle means changes can be run and seen immediately, with no compile wait.
    • or: run-time error detection reports the exact line as soon as it's reached, which suits testing a little at a time.
  • [2] Acknowledges and justifies the trade-off:
    • Execution is slower, but that's acceptable while the application is still being developed and isn't yet in production.
    • A compiler would force a slow recompile after every small change.

Common mistakes that cost marks

  • Writing a list of compiler and interpreter features for "Evaluate" without relating them to the scenario or concluding.
  • Saying interpreters "find all errors before running". That's compilers. Interpreters find errors at run time.
  • Treating bytecode and JIT as "just a bit of both". Explain exactly which part is compiled and which is interpreted, and why that gives portability and speed.

Frequently asked questions

Is A1.4 assessed at SL?
No. The whole of A1.4 Translation is HL only.

Do I need to know about bytecode and JIT compilation?
Yes. The syllabus names just-in-time compilation and bytecode interpreters as part of A1.4.1.


Go further