Translators
An interpreter is a translator that turns high-level source code into machine code one line at a time, while the program is running. It reads a line, translates that line, and the processor carries out the instruction straight away before the interpreter moves to the next line.
The interpreter does not produce object code, so there is no executable file to save and run later. Translation and execution happen together, which is why the interpreter itself must be installed on the computer: without it, the source code cannot be turned into instructions the processor understands.
When the interpreter reaches a line containing a syntax error, it stops at that line, reports the error immediately and does not run the rest of the program. This is useful while you are writing, testing and debugging a program, because a mistake is revealed as soon as the faulty line is reached rather than after the whole program has been checked.
An interpreted program usually runs more slowly than a compiled one. Every line has to be translated again each time the program runs, whereas a compiler translates the whole program once and saves the object code. The interpreter starts running sooner, but the program itself takes longer.
A strength of interpreted code is portability: the same source code can run on any computer that has a suitable interpreter installed. You do not need a separate executable for each type of processor. For example, a short quiz program stored as one source file could be opened on a laptop at home and on a desktop in school, provided both machines have an interpreter that can read that language.
Edexcel GCSE Computer Science · Translators