An interpreter translates a program one line at a time.
Explain why an interpreted program stops when it reaches a line that contains a syntax error.
Mark scheme
Award up to two marks for a linked explanation such as:
- The interpreter translates and executes each line in turn (1) so it cannot continue past a line it cannot translate (1)
- The interpreter finds the error when it reaches that line (1) so it stops and displays an error message before later lines are executed (1)
- Each line is translated just before it is executed (1) so a syntax error in that line prevents that translation/execution from happening (1)
- The interpreter does not translate the whole program first (1) so it only discovers the error when that line is reached during execution (1)
For both marks, the expansion must follow/associate with the statement.
Do not accept 'the program crashes' without saying that the interpreter cannot translate/execute the line.
Do not accept answers about how a compiler reports errors.
Example answers and how they were marked
The interpreter translates each line just before it executes it, so when it reaches the line with the syntax error it cannot translate that line and stops.
Why: Line-by-line translation (1) linked to being unable to translate the faulty line, so stopping (1).
The interpreter translates one line at a time, so it stops at the error.
Why: Line-by-line translation (1); 'stops at the error' repeats the outcome and does not explain why it cannot continue.
It stops because the compiler reports all errors at the end.
Why: Describes a compiler, not an interpreter; no credit.