-
Notifications
You must be signed in to change notification settings - Fork 3
Syntax Definition
Note
This page defines the notation used throughout the Tokens and File Content Syntax pages to describe the grammar of the Convertly language.
Important
This notation is a simplified variant of EBNF. It is used only to describe syntax rules on this wiki, it is not part of the Convertly language itself.
| Notation | Meaning |
|---|---|
[a b c] |
Optional — a b c may or may not appear |
(a b c) |
Grouping only — has no meaning on its own, used to group elements together |
. |
Any character |
a|b |
a or b
|
a+ |
One or more occurrences of a
|
a* |
Zero or more occurrences of a
|
a-b |
Any character in the range from a to b
|
<name> |
A named rule, defined elsewhere as <name> = ...
|
A rule is declared with <name> = ..., where the right-hand side describes what the rule matches using the notation above.
<digit> = 0-9
<letter> = a-z|A-Z
<word> = <letter>+
Once defined, a rule can be reused inside other rules:
<identifier> = <letter>(<letter>|<digit>)*
Important
A named rule will always be defined somewhere on the page before its use or referenced elsewhere.
Any character that is not part of the notation above (see Notation Reference) is treated as a literal constant.
Warning
If a literal character is also a special character used in this notation (such as ., |, +, *, -, <, >, [, ], (, )), it must be escaped with \ to be treated as a constant instead of notation.
\. -> matches a literal dot character
\| -> matches a literal pipe character
\< -> matches a literal '<' character
<sign> = \+|-
<integer> = [<sign>]<digit>+
-
<sign>matches a literal+or- -
<integer>matches an optional sign followed by one or more digits
<comment> = //.*
- Matches
//followed by any sequence of characters
<boolean> = true|false
- Matches the exact word
trueorfalse, nothing else
Home · Files Types . Language · Architecture . API · Examples
Convertly is licensed under CC BY-NC 4.0.