Back to Topic 5
CPUs can only understand Machine Code, the binary opcodes specified by their instruction set and architecture. This language is not very nice for humans to try to solve problems with, so higher level languages have been developed to make programming computers easier. These languages are turned back to machine instructions by the use of a translator.
In the end, everything boils down to binary numbers interpreted as data, addresses and instructions, stored in RAM for the CPU to execute.
Low Level Languages are the native to computers. Their advantages are
High Level Languages are created for human use, so they are
These are the "native" languages of computers, but are difficult for humans to program & maintain large programs.
LABEL MNEMONIC OPERAND COMMENT ASSEMBLED (decimal) INSTRUCTIONS
INP 901
STA count 308
loop OUT ; output current ACC value 902
SUB one 207
STA count 308
BRP loop ; loop while ACC is positive 802
HLT 000
one DAT 1 ; Store the value 1 001
count DAT ; Variable 000
There are many, many, many programming languages out there. See Wiki: List of Programming Languages. And their styles and popularity change over time.
They are classified in many different, overlapping classifications. The main ones are
See Wiki: Comparison of programming paradigms
Eventually, all of these languages need to be translated into Machine Code before they can actually run on a computer. There are two main ways of doing this, Compilation and Interpretation. In reality, things are always less clean cut, e.g.
What you need to know for the exam is
High level languages are translated to machine instructions using compilers or interpreters. One line of high level language can convert to many lines of assembly / machine code.
Look at these two pieces of code
Python 3:
x = 2
y = 3
z = x + y
print(f"{x} + {y} = {z}")
C (GCC 9.2):
#include <stdio.h>
int main() {
int x = 2;
int y = 3;
int z = x + y;
printf("%d + %d = %d", x, y, z);
return 0;
}
Aside / Notes:
Marking schemes for Exam Questions above
2017 May/June Paper 11
2019 March Paper 12
2017 October Paper 11