levo

Applications Generation

Translators: interpreters, compilers and assemblers

  • 2 things to know
  • Component 01

Overview

Recall questions on assemblers, compilers and interpreters, the differences between compiling and interpreting, debugging, speed and distribution, bytecode, one-to-one assembly translation, portability, and choosing a translation approach for a project.

What you need to know

Answer each one before you reveal it.

Your recallNot started
Key term

What is an interpreter?

Key term

State four differences between a compiler and an interpreter.

Questions from this subtopic

Each one with the model answer underneath.

  1. 1

    What is a translator, and why is one needed?

    Model answer

    A program that converts source code written by a human into a form the processor can execute. It is needed because a processor can only execute machine code - binary instructions from its own instruction set - whereas programmers write in assembly language or in high-level languages that are far easier for a human to read and write.

  2. 2

    What is an assembler?

    Model answer

    A translator that converts assembly language into machine code. Because each assembly instruction is a mnemonic for one machine instruction, the translation is essentially one to one, and the resulting machine code is specific to the processor family whose instruction set the assembly language mnemonics belong to.

  3. 3

    What is a compiler?

    Model answer

    A translator that takes the whole of a high-level source program and translates it in one operation into object or machine code, producing an executable file. Once compiled, the program can be run repeatedly without the compiler or the source code being present.

  4. 4

    What is an interpreter?

    Model answer

    A translator that takes high-level source code and translates and executes it one statement at a time, each time the program is run. No separate executable is produced, and the source code and the interpreter must both be present every time the program runs.

  5. 5

    State four differences between a compiler and an interpreter.

    Model answer

    A compiler translates the whole program before any of it runs; an interpreter translates and runs statement by statement. A compiler produces an executable that can be distributed and run without the translator; an interpreter must be present every time. Compiled code runs faster, because translation has already been done and can be optimised; interpreted code is slower because each statement is analysed as it is met, and a statement inside a loop is re-translated on every pass. A compiler reports all the errors it finds at the end of translation and produces nothing until they are fixed; an interpreter stops at the first error, having already run everything before it.

  6. 6

    Why does an interpreter make debugging easier?

    Model answer

    It stops at the point of the first error with the program in a known state, so the offending line is obvious and the values of variables at that moment can be examined. There is also no compile step, so a change can be tested immediately, which makes trying things out much quicker. A compiler by contrast may report a long list of errors, some of them consequences of earlier ones, and gives no running program to inspect until it succeeds.

Other ways to work this

The same content, four other ways.

What is inside Levo

Six ways to work the same material.

1Closed book
2Open book
3Closed book

The 3-step method, run for you

Answer cold, learn it, then prove it stuck. Levo tracks the jump between your first attempt and your last.

Processors: Structure, Performance and Types
Input, Output and Storage
Systems Software
Applications Generation

Cram a whole paper in one sitting

Sort every topic into what you know and what you do not, then drill only the weak ones.

If it matches, the search .
succeedsfailsrestarts

Blank Blitz makes facts automatic

Rapid timed gap-fills on the terms and numbers you need to recall without thinking.

A0 + 0 gives 0.
B0 + 1 gives 1.
C1 + 1 gives 0 carry 1.

Build It gets the exam shape right

Assemble a full-mark answer from its marking points, in the order an examiner wants them.

A global variable means a variable reachable from anywhere in the program.
TrueFalse

Test It catches misconceptions

Spot the fault in a statement. The traps are the mistakes students actually make.

721941163128510

Brain Breaks between sessions

Short focus games to reset attention, so the next set lands better than the last.

Every question in Applications Generation, on a schedule.

Attempt a question from memory, write the correct version, then attempt it again. Levo records the jump between your first attempt and your last, and brings each question back on the day you are due to forget it.

Or £46 a year, about £3.83 a month. Cancel anytime.