A high-level language uses English-like terms that need translating before it can run and a low-level language is assembly or machine code.
Assembly language is turned into machine code using an assembler. High-level languages are turned into a low-level language using a compiler or interpreter.
High level languages enable a programmer to write programs for a computer without knowledge of the hardware and instruction sets of that computer. They are portable programs can be used in different systems. Portable means you can write the program on one computer and run it on another computer.
Advantages of high level languages: Easy to understand, written in short time, errors can be debugged easier, portable, come with libraries of functions.
Disadvantages of high level languages: Must be converted to a low level language before it is run, cannot directly manipulate hardware.
Low level languages are related to the hardware architecture and its instruction set.
There are two types of low level languages, machine code and assembly language.
Machine code is binary instructions that are understandable by the computer.
Assembly language needs to be converted into machine code.
Different computers have different machine code meaning it is less portable.
Assembly language is in-between high level languages and machine code.
It uses mnemonics to represent machine code e.g. STO might be used to store data in a location.
A high level language is converted in mnemonics before it is converted into machine code.
Advantages of low level languages: Language doesn’t need converting, faster execution of code, can directly manipulate the hardware - more efficient in terms of speed and memory.
Disadvantages of low level languages: Difficult to read, understand , and write, therefore harder to debug, not as portable, several instruction needed for high-level command.
To translate a high level language to machine code, you need a compiler. An interpreter executes each statement of a high level language. To translate assembly language to machine code, you need an assembler.
A utility program that translates the program written by programmers and codes in assembly language into binary form, which is understandable by the computer, is called a translator.
A compiler is a computer program that translates a program written in high level language into machine code. It translates all lines into machine code before executing. Reports all errors at once and will not run until they are fixed. It produces an executable file.
Advantages of a compiler: Useful when a program is complete and ready for testing and distribution, code does not need translating each time it is run, source code is not required to run the code (Just an executable file), therefore your code can be hidden.
Disadvantages of a compiler: Not very useful for debugging, you need to have a finished section of code before running.
An interpreter is a computer program that reads a statement from a program written in high level language. It translates into machine code line by line. Stops at the point of error. Reports an error as they occur.
Advantages of an interpreter: Useful when writing programs, you can test parts of your program as you go along, your program does not need to be complete to test parts work.
Disadvantages of an interpreter: Needs translating every time it is run, doesn’t produce and executable filed people can therefore view and access the source code.
An assembler is a computer program that translates a program written in an assembly language into machine code so that is can be directly used by the computer to perform the required task. Once assembled, the same code can be used again multiple times without re-assembly.
An executable file is a file produced by a compiler that can be run independent of translator software and does not include the source code.