The syntax of computer source code is code structured and ordered restricted to computer language rules. Like a natural language, a computer language (i.e. a programming language) defines the syntax that is valid for that language. A syntax error occurs when syntactically invalid source code is processed by an tool such as a compiler or interpreter.
The most commonly used languages are text-based with syntax based on strings. Alternatively, the syntax of a visual programming language is based on relationships between graphical elements.