Machine Code
Machine code is an example of a low level language. Machine code is the computer’s own language it just consists of 1’s and 0’s.
High Level Language
Python and Java are examples of high level languages. Each high level language has been designed for a purpose
Programs written in a high level language are easier to read, write and understand since they use commands which are closer to English
Programs written in a high level language are very portable because they can be easily changed so that they can work on different types of computers
Comparisons
Translators
Humans understand high level languages and computers understand low level languages.
A translator converts high level language commands into Binary.
There are two types of translators:
- Interpreters
- Compilers
An Interpreter
As the program is running, the interpreter takes one line of code at a time and translate it into a low level code.
Advantages of using an interpreter are:
- Don’t have to leave the editing environment when implementing a solution
- Position of errors in code identified during test run
Disadvantages of using an interpreter are:
- Increased processing is required since each program instruction needs to be translated every time it is run (so program will run more slowly)
- Loops are translated multiple times
- Additional RAM is required (since the interpreter needs to be in RAM)
A Compiler
A compiler works by converting the program source code and converting it into object code before the program is run.
- Source Code – is the original high level language program
- Object code – is the machine code program that has been translated
Advantages of using a compiler are:
- the compiled code runs faster (since it is already in machine code)
- code is only translated once
- compiled code cannot be edited
- compiled code requires less memory to execute
A disadvantage of using a compiler is:
- that when you type in the program code, you don’t know if you have made a mistake until you compile it at the end