5 Notation

The syntax is specified using Extended Backus-Naur Form (EBNF).

Grammar: The complete formal grammar is in grammar.ebnf.

5.1 Productions

Productions are expressions terminated by .:

production_name = expression .

5.2 Operators

NotationMeaning
a bSequence
a | bAlternation
[ a ]Optional (0 or 1)
{ a }Repetition (0 or more)
( a )Grouping
"x"Literal keyword
'c'Literal character
'a' … 'z'Character range (inclusive)

5.3 Naming

StyleUsage
lower_caseProduction names
PascalCaseType names
snake_caseFunctions, variables

5.4 Terminology

TermMeaning
shallRequirement (ISO/IEC Directives, Part 2)
shall notProhibition
shouldRecommendation
mayPermission
canPossibility or capability
errorCompile-time failure
panicRun-time failure

5.5 Examples

EXAMPLE 1

@add (a: int, b: int) -> int = a + b;

EXAMPLE 2 The following is not valid because the return type is omitted:

@add (a: int, b: int) = a + b;  // error: missing return type