AQA · GCSE · Computer Science

    Course version: 8525 · Version from Sept 2020

    Interpreters do not generate machine code directly (they call appropriate…

    Full specification wording

    Classification of programming languages and translators: interpreters do not generate machine code directly (they call appropriate machine code subroutines within their own code to carry out statements).

    An interpreter works through a program statement by statement, translating and running each one before moving to the next.

    Checked against the AQA 8525 specification (opens in a new tab) on .

    • Point 15 of 19

    Study notes

    From the checked teaching notes for this specification point.

    The idea

    An interpreter works through a program statement by statement, translating and running each one before moving to the next. Crucially, it does not produce a separate machine code file. Instead, the interpreter program itself already contains pre-written machine code routines, and when it meets a statement it calls the matching routine to carry out that action. So the machine code being executed belongs to the interpreter, not to a newly generated translation of the source. This differs from a compiler, which converts the whole source program into machine code ahead of execution, producing an executable file. Because the interpreter translates and executes as it goes, errors are reported as soon as the faulty line is reached, and execution stops there. The trade-off is speed: interpreting line by line is generally slower than running compiled machine code.

    What earns the marks

    • An interpreter translates and executes source code one statement at a time.
    • The interpreter calls machine code subroutines contained within its own code to perform each statement.
    • Errors are reported when the faulty statement is reached, halting execution at that point.

    Common mistakes and how to put them right

    • Saying an interpreter produces a machine code file.

      Put it right: It does not; it executes statements using its own built-in routines.

    • Confusing interpreter behaviour with compiler behaviour.

      Put it right: A compiler translates the whole program in advance, an interpreter works line by line.

    • Claiming the interpreter converts source into brand-new machine code each run.

      Put it right: The machine code routines already exist inside the interpreter.

    Exam tips

    • State clearly that no separate machine code is generated by the interpreter.
    • Mention that the interpreter calls its own machine code subroutines to carry out statements.
    • Contrast with a compiler to show you understand the difference in translation approach.

    Try the lesson

    The start of the Classification of programming languages and translators: interpreters do not generate machine code directly (they call appropriate machine code subroutines within their own code to carry out statements). lesson, made from checked teaching notes for this specification point.

    Have a go first

    When an interpreter runs a high-level program, how does it carry out each statement?

    There is more to this lesson

    The full lesson goes on to check your understanding and help you earn the marks. Create a free account to carry on, with your progress saved.

    Carry on with the full lesson

    A week of Premium from your first lesson · Then the free plan continues · No card, no charge

    Test your understanding of Classification of programming languages and translators: interpreters do not generate machine code directly (they call appropriate machine code subroutines within their own code to carry out statements).

    Active recall beats re-reading. Take an instant quiz now to test what you’ve learned and lock it into long-term memory.

    Take topic quiz

    A week of Premium from your first lesson · Then the free plan continues · No card, no charge