2. High Level Languages
Programming languages are generally similar to the English
language. They use words like If, Else, Repeat, While etc.
These languages are known as high level languages.
3. Low Level Languages
The computer does not understand high level languages. It
understands binary codes which are referred to in
programming as machine codes e.g. 10010010 01101010.
These languages are known as low level languages.
4. Low Level Languages
Machine Code in the form of binary is extremely difficult
for humans to read. To make it (slightly) easier to read
and understand, Assembly Language was devised.
Each Assembly Language command can be converted to
machine code.
5. Translators
So, humans understand high level languages
and
Computers understand low level languages.
To get our high level languages into a form that the computer
understands, we need a translator.
A translator converts high level language commands into low
level language commands.
6. Interpreters and Compilers
In order to resolve this problem, there are two ways to
convert the high level language written by humans into a
low level language understood by computers.
These are interpreters and compilers.
7. Interpreters
As the program is running, the interpreter takes one line of
code at a time and translate it into a low level code.
IF age > 18 THEN
displayfield.text = “Left school”
END IF
8. Interpreters
As the program is running, the interpreter takes one line of
code at a time and translate it into a low level code.
10011001 00010110 11000100 00010011
displayfield.text = “Left school”
END IF
9. Interpreters
As the program is running, the interpreter takes one line of
code at a time and translate it into a low level code.
10011001 00010110 11000100 00010011
10010010 11110001 00000001 10011011
00110101 01111110
10. Compilers
A compiler works by converting the program source code
and converting it into object code before the program is
run.
IF age > 18 THEN
displayfield.text = “Left school”
END IF
11. Compilers
A compiler works by converting the program source code
and converting it into object code before the program is
run.
10011001 00010110 11000100 00010011
10010010 11110001 00000001 10011011
00110101 01111110
12. Compilers vs Interpreters
Interpreters are slower than compilers when the program is
running because they have to interpret each line
The interpreter needs to be in memory each time the program
is run, whereas compilers do not
Interpreters can make debugging a program easier because
they can track errors line by line
Compilers have to have programs recompiled each time the
code is changed, even if the change is minor