Skip to main content

An error which occurs when a program does not follow the syntactical rules of the programming language.

Syntax errors are often caused by a spelling mistake, missing characters (such as a closing parenthesis), or badly indented code.

The compiler/interpreter of the program often displays the position of the syntax error. However, in complex projects, this indication is not guaranteed to be correct. For instance, a missing token at line 7 can be compensated by the appearance of the same token at line 10. Some compiler/interpreters continue processing the code and throw a syntax error at the end, because of a missing token.