| Programming : Translation
|
|
|
High level language programs must be
translated into
machine code before they can be executed. This can be done
automatically using either an interpreter or a compiler.
- Interpreter : Converts each high-level instruction into machine code every time the program is executed. The
interpreter software must be loaded whenever the program is executed, using up memory. Converting the
instructions each time the program is run means interpreted programs run slowly.
- Compiler : Converts the whole program into machine code once and stores the resulting machine code program
(called object code) in a file. The object code can then be run without performing any translation. The compiler
does not need to be loaded to run the code and code will run more quickly than an interpreted program because
no translation is required.
Programs are often developed using an interpreter because an interpreter can execute working parts of a program even
if some parts do not yet work. When the program works properly it is then compiled so it will run faster and use up less
memory. Most sophisticated, large computer programs are written using high-level languages.
Some languages such as BASIC usually use an interpreter. Other languages such as Pascal normally use a compiler.
GCSE ICT Companion 04 - (C) P Meakin 2004