16.2 Translation Software


2026 Syllabus Objectives

By the end of this section, you should be able to:

  • Show understanding of how an interpreter can execute programs without producing a translated version.
  • Show understanding of the various stages in the compilation of a program, including lexical analysis, syntax analysis, code generation, and optimisation.
  • Show understanding of how the grammar of a language can be expressed using syntax diagrams or Backus-Naur Form (BNF) notation.
  • Show understanding of how Reverse Polish Notation (RPN) can be used to carry out the evaluation of expressions.

1. Interpreters — Running Programs Without Translating Them First

Before a computer can run a program written in a high-level language (like Python or Pascal), it needs to understand what the instructions mean. One way to do this is with an interpreter.

An interpreter is a type of translator. However, unlike a compiler (which translates the whole program at once before running it), an interpreter works one statement at a time. It reads the first line of your program, checks whether it follows the correct rules, and then immediately carries out that instruction. Then it moves to the next line and repeats the process.

Because of this approach, an interpreter never produces a separate, permanent translated version of the program. Every time you run the program, the interpreter has to translate it all over again from scratch. No file called "object code" or "executable" is saved.

This has some important consequences:

  • Errors are reported immediately. If the interpreter reaches a line with a mistake, it stops right there and tells you what went wrong and where. This makes it very useful during development and debugging, because you can see problems as soon as they appear.
  • Every loop is re-translated each time. If a loop runs 1000 times, the interpreter translates the instructions inside it 1000 times. This makes interpreted programs run slower than compiled ones.
  • The source code must be present every time the program runs. The interpreter needs the original high-level code each time, which means the source code cannot easily be hidden from users.

In summary: an interpreter executes a program directly by reading, translating, and running each statement in sequence, without ever creating a standalone machine-code file.

Sign in to view full notes