Menu

Low and High Level Languages

Instruction Sets

An instruction set is the collection of instructions that a particular processor can execute. Each instruction does one tiny job, such as adding two values, comparing two values or jumping to a different part of a program. The processor can carry out nothing that is not in its own set, so the set is the limit of what the hardware can do. A small processor inside a car park barrier might have an instruction set of a few dozen entries, while the processor in a laptop has hundreds.

Processors from different manufacturers often have different instruction sets, so a low-level program is written for one particular processor. Languages are classified by how close their instructions sit to that set.

Low-level languages are close to the processor

Low-level languages are close to the hardware, because their instructions relate almost one for one to the instructions the processor already knows. Machine code is made of binary instructions from that set, and assembly language gives each instruction a short name (a mnemonic) so a person can read it. Writing in a low-level language means choosing from the instruction set yourself, which is why you need to understand how the processor works.

High-level languages are further away

High-level languages are further from the processor. A statement written in one of these languages says what you want to happen rather than which instructions to use, so it usually has to be broken down into several instructions from the set before it can run. For example, a single high-level line that adds ten points to a player's score does three low-level jobs: read the score from memory, add ten to it, and write the new value back.

The statement score = score + 10 is broken into three instructions: read the score from memory, add ten and write the value back, shown as assembly, then machine code, all from the processor’s instruction set.

Language levelDistance from the instruction setTypical unit of code
Machine codeUses instructions from the set directlyOne binary instruction
Assembly languageOne step away: one short name per instructionOne mnemonic, with or without operands
High-level languageFar away: each statement usually becomes several instructionsOne statement, such as an assignment

Practise this