Most contemporary programming is carried out using high-level languages. High-level languages have the following characteristics:
High-level languages require translator software that will be held in RAM when a program is executed. It is the translator software that will take the code written in a high-level language and translate it into 'executable code'. Executable code is in binary form and can be understood by the processor. Unlike low-level languages, there is no one to one conversion between code and binary instructions.
Translator software usually comes in the form of either a compiler or an interpreter.
When translating using an interpreter, each line of source code will be translated to machine code one line at a time. As soon as a line of code is translated into machine code, it is executed. If an error is encountered the interpreter will not move on to translate the next line. It will notify the user of an error immediately.
This means that the interpreter software is present in main memory during each execution of the program and for the execution of every line. In this sense, an interpreter is not as efficient as a compiler.
The advantage of using an interpreter is that the execution will stop immediately if the interpreter translates a line of source code that results in an error. This makes an interpreter a useful tool to assist programmers as they attempt to identify and rectify errors. The interpreter cannot determine the actual error but can indicate the line that was not translated into executable machine code.
A compiler will translate the source code into what is known as object code. The compiler is held in RAM only for the time that it takes to translate the source code into object code. Compilers will translate lines one after the other, but they do not execute a line immediately after translation. Instead, the object code file can be used to run the program after translation.
Once object code has been created it is possible to run this code independently of the development environment and translator software. Using a compiler once to create object code makes run time more efficient but if the source code contains errors the programmer would need to re-compile to make use of the corrected object code.
High-level languages are easier to read, write and maintain than low-level languages. This is because high-level languages use terms that are similar to English. An example is the print command that is used in various high-level languages.
The following line of code from a high-level language is easy for a human to understand.
Print 'hello world'
Without a lot of background knowledge it is possible for a human to understand that this line of code would show the words ‘hello world’ on screen. This also makes high-level languages easier to maintain in the future if a programmer needs to alter code that has been created by another programmer.
Programmers can also access module libraries when they are using a high-level language. Module libraries contain sections of pre-written and pre-tested code that can be used without the need to spend additional time on creation and testing.
As well as being able to access module libraries, programmers can make use of in-built functions such as length(), which can be used to return the length of string variable.
High-level languages will also make use of data types such as String, Integer, Boolean and Real as well as data structures such as 1-D Arrays and, in some cases, records. Selection statements such as nested If Statements and Case statements as well as the use of iteration are also features of high-level languages.
There are three forms of high-level language within the course:
Each language has its own set of characteristics and makes use of different features of high-level languages.