• Practice
  • About 13 min
  • 5 practice questions

Language translators: compiler, interpreter, assembler

Explain what each language translator does and choose the right one in exam questions.

If something looks wrong, please tell us.

A computer understands only machine language, made of 0s and 1s. Programmers write in easier languages, so a translator is needed. Three translators appear in almost every paper: the assembler, the compiler and the interpreter.

What each translator does

Translators
TranslatorTranslatesMethod
AssemblerAssembly language to machine codeConverts the whole program
CompilerHigh-level language to machine codeTranslates the whole program at once, then reports all errors together
InterpreterHigh-level language to machine codeTranslates and runs one statement at a time, stopping at the first error

Language levels

Machine language is the lowest level and runs directly. Assembly language uses short symbolic names (mnemonics) such as ADD. High-level languages use English-like statements and are easier to write and read. High-level and assembly languages are source programs; the translated result is the object code.

Worked examples

Example 1. A program is translated fully before it is run and all errors are listed together. Which translator? A compiler.

Example 2. A beginner wants a program to stop at the exact line where the first error occurs. Which translator helps? An interpreter, because it works line by line.

Compiler = whole program, then run. Interpreter = line by line. Assembler = assembly language only.

— Rule to remember

Key takeaways: compiler works on the whole program, interpreter works line by line, assembler handles assembly language, and only machine language runs directly.

Check your understanding

  1. 1. A program is translated fully before it is run, and all its errors are listed together. Which translator is this?

    1. Interpreter
    2. Compiler
    3. Device driver
    4. Text editor
    Show answer

    Answer: B. A compiler translates the whole program at once and reports all errors together. An interpreter stops at the first error.

  2. 2. A beginner wants a program to stop at the exact line where the first error occurs. Which translator helps?

    1. Compiler
    2. Assembler
    3. Interpreter
    4. Antivirus
    Show answer

    Answer: C. An interpreter translates and runs one statement at a time, so it stops at the first error.

  3. 3. Short symbolic names such as ADD, used in assembly language, are called

    1. Object code
    2. Pseudocode
    3. Binary digits
    4. Mnemonics
    Show answer

    Answer: D. Assembly language uses short symbolic names called mnemonics, such as ADD.

  4. 4. The translated result of a source program is called

    1. Source code
    2. Pseudocode
    3. Assembly language
    4. Object code
    Show answer

    Answer: D. The program as written is the source program; the translated result is the object code.

  5. 5. Which language does a computer run directly, without any translator?

    1. Assembly language
    2. High-level language
    3. Pseudocode
    4. Machine language
    Show answer

    Answer: D. Only machine language, made of 0s and 1s, runs directly. Assembly needs an assembler; high-level languages need a compiler or interpreter.

Privacy · Terms · Refunds · Delivery