AQA · GCSE · Computer Science
Course version: 8525 · Version from Sept 2020
Robust and secure programming: syntax error
A syntax error is a breach of the grammar of the programming language, so the code cannot be translated into a runnable program.
Checked against the AQA 8525 specification (opens in a new tab) on .
- Point 12 of 14
Study notes
From the checked teaching notes for this specification point.
The idea
A syntax error is a breach of the grammar of the programming language, so the code cannot be translated into a runnable program. The translator checks the source against the language rules and reports the fault, often with a line number. Typical causes include a missing or mismatched bracket, a missing colon or quote mark, a misspelled keyword or variable name used before it is declared, and an operator used with the wrong number of operands. Because translation stops or fails, the program never executes, so a syntax error is detected before any output is produced. When you meet a scenario, check whether the code could ever be translated: if not, the fault is syntactic. Fixing it means correcting the grammar, not changing the algorithm's logic.
What earns the marks
- Defines a syntax error as code that breaks the grammar rules of the programming language.
- States that a syntax error prevents the program from being translated, so it cannot run.
- Gives a valid example such as a missing bracket, missing quote mark or misspelled keyword.
- Explains that the translator reports syntax errors, often identifying the line where the fault occurs.
- Distinguishes a syntax error from a logic error, which allows translation and execution but gives wrong output.
Common mistakes and how to put them right
Confusing a syntax error with a logic error.
Put it right: Is that a syntax error stops translation, whereas a logic error lets the program run but produce wrong results.
Thinking a syntax error only appears when the program runs.
Put it right: Is that it is detected during translation, before execution.
Assuming any wrong output is a syntax error.
Put it right: Is that wrong output from a running program points to a logic error.
Exam tips
- Check whether the described code could be translated at all; if not, it is a syntax error.
- Learn three concrete examples (missing bracket, missing quote, misspelled keyword) to recognise the category quickly.
- Remember the translator reports the fault, so link syntax errors to the translation stage rather than to runtime testing.
Try the lesson
The start of the Robust and secure programming: syntax error lesson, made from checked teaching notes for this specification point.
Have a go first
A program line reads: total = (price + tax What kind of error is this?
There is more to this lesson
The full lesson goes on to check your understanding and help you earn the marks. Create a free account to carry on, with your progress saved.
A week of Premium from your first lesson · Then the free plan continues · No card, no charge
Test your understanding of Robust and secure programming: syntax error
Active recall beats re-reading. Take an instant quiz now to test what you’ve learned and lock it into long-term memory.
A week of Premium from your first lesson · Then the free plan continues · No card, no charge