Notation¶
This documentation uses Extended Backus-Naur Form (EBNF) to represent the Nite language syntax. EBNF can be hard to read at first, so we recommend giving this page at least a glance before reading the rest of the specification.
Grammar rules¶
A grammar rule has the form name = definition ;, where name is the name of the rule and definition is the grammar expression the rule matches.
The right-hand side is built from the following constructs:
- Terminals are written in double quotes (e.g.
"+") or in rare cases in single quotes (e.g.'"'), and match themselves literally. - Nonterminals are written in plain words (e.g.
identifier) and match whatever the named rule defines. -
Concatenation is an expression followed by another expression; both must match in order:
-
Alternation is an expression followed by
|followed by another expression; either may match: -
Optional is an expression wrapped in square brackets; it may match or be skipped:
-
Repetition is an expression wrapped in curly braces; it matches the expression zero or more times:
-
A group is an expression wrapped in parentheses, used to make precedence explicit:
-
Special sequences are wrapped in question marks and describe a match in words rather than symbols:
Reserved notation¶
A few characters are used by the notation itself (", |, [, ], {, }, (, ), ,, ?, =, ;). When a grammar needs to match one of these characters literally, it is written inside double quotes, e.g. ",".