Syntax

From Mario Fan Games Galaxy Wiki
Revision as of 17:11, 19 March 2010 by Xgoff (talk | contribs) (Created page with 'The '''syntax''' of a programming language is the set of rules that defines what combination of identifiers and other symbols are allowed. It is one of the factors that different…')
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

The syntax of a programming language is the set of rules that defines what combination of identifiers and other symbols are allowed. It is one of the factors that differentiates between languages, at least visually.

Complexity of syntax varies across languages, with some having very rules and others having extensive rules allowing for a lot of syntactic sugar. Syntax highlighting is a method of making source code more readable (by using different colors, font weights or sizes, etc.) by applying these styles to certain elements such as keywords and operators.

Many languages share similar syntax for various reasons, often familiarity. This is apparent in "curly-brace" languages like C and C++, Java, and Javascript, and among the different Lisp dialects. Otherwise, differences may be due to aesthetic preference, ease of parsing, convenience, or many other reasons.

Special notations such as BNF are often used to define the syntax of a language, though it can't represent semantic limitations that may otherwise appear as valid syntax.