Skip to content

9618 · 5.2

Language Translators flashcards

Revision flashcards for Cambridge 9618 Language Translators (syllabus 5.2). Flip, recall, then mark a real past-paper question.

  • Card

    What is a language translator?

    A program that converts source code written in a programming language into machine code or another target language that a computer can execute.

  • Card

    What is a compiler?

    A translator that converts an entire high-level language program into a complete machine code file (object code) before the program is run. This file can then be executed independently.

  • Card

    What is an interpreter?

    A translator that reads a high-level language program one statement at a time, translating and executing it immediately before moving to the next line. It does not produce a separate executable file.

  • Card

    What is an assembler?

    A translator that converts low-level assembly language into machine code. It performs a near one-to-one translation of mnemonics to binary instructions.

  • Card

    What is source code?

    The original program code written by a human programmer in a high-level or low-level programming language.

  • Card

    What is object code (or machine code)?

    The low-level binary instructions that a computer's processor (CPU) can directly execute. It is the output of a compiler or assembler.

  • Card

    What is the first stage of compilation?

    Lexical Analysis. The source code is scanned, and sequences of characters are grouped into tokens (keywords, identifiers, operators). Unnecessary whitespace and comments are removed.

  • Card

    What is the second stage of compilation?

    Syntax Analysis (or Parsing). The stream of tokens is checked against the grammar rules of the language. A parse tree is typically generated to represent the program's structure.

  • Card

    What are the final two stages of compilation?

    Code Generation and Optimisation. The parse tree is used to generate machine code. This code is then optimised to make it run faster or use less memory.

  • Card

    What is intermediate code?

    A representation of the source code produced by the compiler after syntax analysis. It is language-independent and easier to optimise before final code generation. Some languages, like Java, compile to an intermediate form called bytecode.

  • Card

    Common Trap: Is an assembler a type of compiler?

    No. A compiler translates a high-level language (one-to-many mapping of statements to instructions). An assembler translates a low-level assembly language (one-to-one mapping of mnemonics to instructions).

  • Card

    Advantage of an interpreter for debugging?

    Errors are reported as soon as they are encountered on a specific line, making it easier to pinpoint and fix bugs during development. The program stops at the point of error.