GCSE Link: 2.16 - Programming Language Classification
Programming languages can be split into two types: high-level and low-level languages
Some examples of high-level languages include Python, Java, Thunno, and Go.
The only low-level languages are assembly language and machine code.
Machine code is written in binary, and is the only form of code that a computer can understand.
Each instruction in assembly language represents one instruction of machine code.
Example 1 (Python) and Example 2 (AQA assembly language) show exactly the same algorithm in different languages.
Example 1
a = int(input())
print(a * a)
Example 2
LDR R0, #0
LDR R1, 101
LDR R2, 101
loop:
CMP R2, #0
BEQ end
ADD R0, R0, R1
SUB R2, R2, #1
B loop
end:
STR R0, 102
HALT
Advantages of high-level languages:
Advantages of low-level languages:
Only machine code can be understood by the computer. Everything else has to be translated (converted) into machine code.
Translators are a type of software which translate (convert) code into machine code that the computer can run.
There are three types of translator: compilers, interpreters, and assemblers.
Compilers and interpreters work on high-level languages. Assemblers work on assembly language.
Compilers translate a whole program directly into machine code, while interpreters translate one line at a time, calling machine code subroutines to execute the file.
What are the advantages and disadvantages of compiled languages as opposed to interpreted languages?
Advantages:
• Compilation results in an executable machine code file which will run more quickly than interpreted code
• The original source code cannot be retrieved once compiled, which is good for mass distribution (e.g. games)
• The file can be run directly without any other software
Disadvantages:
• Compilation can take a long time for larger projects
• The executable file is specific to a processor type and will not run on devices with other processors