Syntax (programming languages)
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 a 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.
When designing syntax, a designer of any language might start by writing down examples of both legal and illegal strings, before trying to figure out the general rules from those examples in use. Such that its general structure of syntax can be determined through its form of composition, so to yield semantically valid ranges everytime for each possible alteration. Or else, it returns errors, and warnings, for each invalid input.