0984

Programming Languages and Translators

Software · 4 question types

Exam Frequency Analysis

Past paper frequency (2018 to 2024)

This topic accounts for approximately 4% of your exam marks.

stable
Rare
Stable4%

Compiler vs interpreter differences are a recurring 3-mark question.

A low-level language is one where each instruction maps directly or very closely to a single machine-code instruction, and where the programmer has direct control over the computer's hardware (registers, memory addresses, processor instructions).

There are two low-level languages to know: and .

Machine code (1st generation)

Machine code is the raw binary language the CPU runs directly. Every instruction is a string of 1s and 0s that matches one specific operation in the CPU's instruction set.

A machine-code instruction might look like 10110111 00000101, which is meaningless to a human reader, but the CPU can execute it without any translation step.

  • Directly executed by the processor.
  • Specific to one CPU architecture. Machine code for an Intel x86 chip will not run on an ARM chip.
  • Almost impossible to write by hand for any non-trivial program.

Assembly language (2nd generation)

Assembly language is a low-level language where each binary machine-code instruction is replaced with a short, human-readable abbreviation called a .

Typical assembly mnemonics:

MnemonicMeaning
LDALoad: copy a value from memory into the accumulator
STAStore: copy the accumulator's value into a memory location
ADDAdd a value to the accumulator
SUBSubtract a value from the accumulator
JMPJump to a different instruction
HLTHalt the program

Assembly is far easier for humans to write than raw machine code, but it is still one-to-one with machine code: each assembly instruction translates to exactly one machine-code instruction.

Before assembly can run, it must be translated into machine code by a piece of software called an (covered in section 4).

Why use a low-level language?

Modern programmers rarely write entire programs in assembly, but low-level code is still used for specific situations:

  • When direct hardware control is needed (writing a device driver, programming a microcontroller, talking to specific CPU registers).
  • When maximum speed is needed in a small section of code (game engines, signal processing).
  • When memory is very tight (embedded systems, boot loaders, small microcontrollers).
  • When the code is specific to a particular CPU anyway, so machine dependence is not a problem.

Advantages and disadvantages of low-level languages

AdvantagesDisadvantages
Direct control of memory, registers and hardwareHard to read and write for humans
Efficient: small memory footprint, very fast executionMachine-dependent: code only runs on one CPU architecture
Predictable timing (useful in real-time systems)Easy to make mistakes that crash the system
Slow to develop compared to high-level languages
Exam tip

Giving a benefit of using a low-level language

What comes up: A question asks for one advantage of writing code in a low-level language (assembly) rather than a high-level language.

Write: Any one of: (1) the programmer has direct control over the hardware (registers, memory addresses); (2) the code executes faster and uses less memory; (3) the programmer can use processor-specific instructions that are not available in a high-level language.

Watch out: Saying the code "does not need to be translated" is only partly true for assembly (it still needs an assembler); machine code alone needs no translation. Keep your answer precise about which level you mean.