High-level code can be translated by a compiler or by an interpreter.
Describe how a compiler translates high-level code differently from an interpreter.
Mark scheme
Award up to two marks for a linked description such as:
- The compiler translates the whole program/complete source code in one go (1) whereas the interpreter translates one line/statement at a time (1)
- The compiler translates all of the source code before any of it is run/executed (1) but the interpreter translates each line/statement as it reads it (1)
- The interpreter translates one line/statement at a time (1) and the compiler translates the whole program/source code together (1)
Accept the compiler point and the interpreter point in either order.
Do not accept responses about object code/executable files, when the translated code is executed, how errors are reported, or speed/memory use.
Do not accept 'the interpreter executes/runs each line' on its own, without saying that it translates one line/statement at a time.
Example answers and how they were marked
A compiler translates the whole program in one go, while an interpreter translates one line at a time.
Why: Whole program translated in one go (1) and interpreter translates one line at a time (1).
A compiler translates the whole program in one go.
Why: Whole program translated in one go (1); no linked point about the interpreter translating a line at a time.
A compiler produces an executable file, but an interpreter does not.
Why: Describes the output, not the amount translated at a time; object code/executable files are not accepted.