Check you understanding at AS level first
Compilers, interpreters and assemblers - Describe the function of translation programs in making source programs executable by the computer.
Compilers, interpreters and assemblers - Describe the purpose and give examples of the use of compilers, interpreters and assemblers, and distinguish between them.
Compilers, interpreters and assemblers - Distinguish between and give examples of translation and execution errors.
The purpose of an assembler is to translate assembly language into machine (executable) code
An interpreter takes a single source code instruction as input, translates and executes it.
Converts high level languages into machine code one instruction at a time on-the-fly while the program is running.
Each instruction is converted to machine code once the previous instruction has been executed
Good for debugging code because the program stops as soon as the error has been found.
Running code this way is much slower running compiled code
Machine code is not saved
Both source code and interpreter are needed for the code to be executed
A compiler takes the entire program as input to produce a machine code version of the program.
Converts high level languages into machine code before the program is run.
Saves the machine code, so the sources code is no longer needed
Software is normally distributed as compiled machine ocde. For proprietary software this is good because other people can not copy the code and use it for their own applications
For it to be executed only the machine code is needed, a translator is not
Compiled code can only be run on the spefici processor and OS which it was compiled ofr in the first place
An assembler's source code is low level code
An assembly instruction which will translate to one machine code instruction
Interpretation needs to be repeated each time the program is run
Compliers translate high level source code
Singles lines of high level code compiles to many machine code instructions.
A compiled program can be re-run without further translation.
Errors are reported after compilation has finished.
One error may cause many related/spurious errors
Recompiling after fixing an error adds time to the process
Once compiled the program will run quickly i.e. the object code will be efficient because the compiler will translate directly to the native code of the specified machine. It will optimise the code for the target hardware
Protection of intellectual property i.e. protected by law against copying, theft, or other use that is not permitted by the owner.
For the program developer debugging can be easier as interpreter will stop translation at the point where the error occurred. This highlights the erro for the programmer to deal with
Code is more portable as it is not machine dependent and will run on different hardware or in a browser
For security when downloading code from the Internet it can be checked before interpreting on the local machine
Syntax Error - Problem with spelling, punctuation or grammar.
Error = If without ENDIF
Linking Error - Calling a standard function where the correct library has not been linked to the program.
Error = When the Square-root function is used and the library that calculates the Square-Root has not been linked to the program.
Semantic Error - variable declared illegally i.e. doesn't exist
Runtime/Execution - a runtime error is an error that only occurs when the program is running and is difficult to foresee before a program is compiled and run.
Error = Program requests more memory when none is available so the program crashes
Logical Error - An error that causes a program to output an incorrect answer (that does not necessarily crash the program)
Error = An algorithm that calculates a person's age from their date of birth but ends up giving negative numbers
Rounding Error - When a number is approximated to the nearest whole number/tenth/hundredth etc
Error = 34.5 rounded to nearest whole number is 35, an error of +0.5
Truncation Error - When a number is approximated to a whole number/tenth/hundredth etc nearer zero
Error = 34.9 rounded to whole number is 34, an error of +0.9
Compilation process
See AS page (link at top)