Language translators

Computer Science AS · System software. The idea in plain words, the rules to remember, the mistake to avoid and a worked example, written and checked by Mega Lecture.

Test this topic freeAll Computer Science AS topics

The idea

A processor can only run machine code, so every program written in another language needs a translator. An assembler translates assembly language (mnemonics) into machine code. A compiler and an interpreter both translate a high-level language, but they work in different ways.

A compiler translates the whole program before it is run and produces an executable file. An interpreter translates and runs one statement at a time and produces no executable file. Some languages, such as Java, use both: the source code is compiled to bytecode, then a virtual machine interprets the bytecode.

An IDE is software that gives the programmer an editor, a translator and debugging tools in one place.

Rules to remember

Common mistake

Do not say that an interpreter produces an executable file or that compiled code needs the compiler to run. Only a compiler produces an executable, and after that the compiler is no longer needed.

Worked example

A programmer is testing a new game and will later sell it to the public. Which translator suits each stage, and why?

  1. While testing, the programmer wants to find and fix errors quickly and run parts of the program. An interpreter stops at the line with the error, so it suits this stage.
  2. When selling, customers should not see or change the source code and should not need a translator. A compiler produces an executable file that meets both needs.
  3. The compiled executable also runs faster, which matters for a game.

Answer: Interpreter during development; compiler for the version that is sold.

Ask about this

Type what you are stuck on. The helper finds the explanation, worked examples and the notes to read, free and instant.

Keep going

← Operating systemsData security →Take a Computer Science AS test