Skip to content

Syntax Definition

Tsukini edited this page Jul 4, 2026 · 1 revision

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.

Table of Contents

Notation Reference

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> = ...

Rule Definitions

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.

Constants

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

Examples

<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 true or false, nothing else

Clone this wiki locally