This article needs additional citations for verification. (August 2013) |
The syntax of computer source code is the form that it has – specifically without concern for what it means (semantics). Like a natural language, a computer language (i.e. a programming language) defines the syntax that is valid for that language.[1] 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 sequences of characters. Alternatively, the syntax of a visual programming language is based on relationships between graphical elements.
When designing the syntax of a language, a designer might start by writing down examples of both legal and illegal strings, before trying to figure out the general rules from these examples.[2]