High Level Programming Language
- Closer to human language // closer to English
- Independent of a particular type of computer/device/platform // portable language
- A language such as Python, Java, Pascal, etc.
Advantages of High Level Programming Language
- Easier/faster to write code as uses English-like statements
- Easier to modify as uses English-like statements
- Easier to debug as uses English-like statements
- Portable language code
Low Level Programming Language
- Close to the language processed by computers
- May use mnemonics
- Low level languages relate to the specific architecture and hardware of a computer
- Can be machine code (binary), requires no translation
- Can be assembly language, requires translation using an assembler
Advantages of Low Level Programming Language
- Can be executed faster
- No requirement for the program to be portable
- Program will be more memory efficient
- No requirement for a compiler/interpreter
- Can use specialised hardware
Why a compiler or an interpreter is needed when running a high-level program
- Code is required to be converted into machine code/binary
- Code needs to be produced that can be understood by the computer
Compiler
- Translates high-level language to low level language
- It translates all code before it is executed
- A list of errors in the code is created
- It creates an executable
Describe how a Compiler reports errors
- It creates an error report after trying to compile
- …displaying all errors in the code
- …that require correction before execution can take place
Compiler Advantages/Disadvantages
- Executable files can easily be produced and distributed to users.
- Once the executable file is produced, users do not need the compiler software.
- Users cannot change or illegally use the original source code.
- Faster execution of program
- The final object file is only produced when all errors in the source code have been located and fixed.
- Uses a lot of resources. During the compilation process, memory contains the compiler software, source code, object code, memory for working storage.
- Difficult to find errors so the procedure is time consuming with several runs of the compiler before all the errors are located.
Interpreter
- Translates a program one line of code at a time
- Machine code is directly executed // The interpreter is used each time the program/code is executed
- Will identify an error as soon as it finds one in a line of code
- Interpreters are commonly used for testing a program
Interpreter Advantages/Disadvantages
- Produces error messages as each instruction is translated so debugging is easier and faster.
- An interpreter halts (stops) when it encounters a syntax error. So errors can be corrected in real time.
- The programmer can attempt to run and test the program at any time including before all the code has been written.
- The effect of any change made to the code can be seen immediately.
- Execution is slower than compilers because no executable files are produced. Every time the program is executed it has to be first translated.
- The interpreter software has to be present in memory every time an attempt is made to run the program.
- No executable file produced: so all users must have the interpreter software available and the code is not protected therefore other programmers could make unwanted changes.
Assembler
- Translates a low level language into machine code
- An executable file of machine code is produced
- One low-level language statement is usually translated into one machine code instruction
- Assembled programs can be used without the assembler
- An assembled program is usually distributed for general use
IDE (Integrated Development Environment)
What is an IDE?
- Used by programmers to aid in the writing, editing and development of programs.
- Provides a code editor
- Provides translation for code with an Interpreter/Compiler
- Allows testing program code / observe outputs
Features of an IDE:
- Code editor
- Run-time environment
- Translators
- Error diagnostics
- Autocompletion
- Auto-correction
- Pretty-print