Written by the Fiveable Content Team โข Last updated September 2025
Verified for the 2026 exam
Verified for the 2026 examโขWritten by the Fiveable Content Team โข Last updated September 2025
Definition
A syntax error is a mistake in the structure or format of a program's code that prevents it from being compiled or executed properly. It occurs when the code violates the rules and grammar of the programming language.
Related terms
Logic Error: A logic error refers to a mistake in the algorithm or flow of a program that causes incorrect output or unexpected behavior.
Runtime Error: A runtime error occurs during program execution when something unexpected happens, such as dividing by zero or accessing an invalid memory location.
Compiler: A compiler is a software tool that translates human-readable source code into machine-executable instructions. It checks for syntax errors and generates an executable file if there are no errors.