Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

Syntax

Notation

NotationExampleDescription
TypeWriterifThe exact character(s)
ItalicIdentifierA syntactical production
x ::= yNull ::= nullDefinition of a syntactical production
x yspawn ExpressionConcatenation of x and y
x?Expression?The item x is optional
x*Char*0 or more occurrences of x
x+Digit+1 or more occurrences of x
x | ytrue | falseEither x or y
[ x - y ][ 0 - 9 ]One of the characters in the range
( x y )( Value , )*Group multiple items

Identifier

Identifiers used for variables, channels, object members, and function names comply with the Unicode Standard Annex #31.

Identifier ::= Start Continue*

Where Start is a character from the Unicode set XID_Start or the underscore character *, and Continue is a character of the set XID_Continue.

Example

var1

ladungsträger

_12

Furthermore, scoped identifiers are used to identify variables and functions from the standard library.

ScopedIdentifier ::= ( Identifier :: )* Identifier

Example

action::pickup

log::info

Value

Value can be one of:

SyntaxName
nullNull
true | falseBool
Digit+ (. Digit+)?Number
" Char* "String
[ ( Value , )* ]Array
{ ( ( Identifier | String ) : Value , )* }Object

Digit ::= [ 0 - 9 ]

Char can be any valid Unicode character, with the exception that " and \ must be escaped by a preceding \. Furthermore, we allow using \n inside strings for adding line breaks.

Expression

Expression can be one of:

SyntaxName
ValueValue
ScopedIdentifierVariable
<- ExpressionReceive
UnaryOperator ExpressionUnary
Expression BinaryOperator ExpressionBinary
( Expression )Group
Expression [ Expression ]Index
Expression . IdentifierMember
Expression ( ( ( Identifier : )? Expression , )* )Call
spawn ExpressionSpawn

UnaryOperator ::= - | !

BinaryOperator ::= +| - | * | / | % | ?? | == | != | < | <= | > | >= | and | or

Statement

Statement can be one of:

SyntaxName
Expression ;Expression
let Identifier = ExpressionDeclaration
Identifier = ExpressionAssignment
Expression <- ExpressionSend
if Expression { Statement* } ( else { Statement* } | else If-else )?If-else
while Expression { Statement* }While
return Expression? ;Return
break ;Break
continue ;Continue

Workflow

Workflow ::= GlobalDeclaration* actions { Statement* } GlobalDeclaration*

GlobalDeclaration can be one of:

SyntaxName
global Identifier = Expression ;Global Variable
function Identifier ( ( Identifier , )* ) { Statement* }Function

Comment

To document code, comments can be used. Comments can be placed anywhere in the code except within string literals. Two types of comments are supported. Firstly, single-line comments, which start with // and comment out the rest of the line. Secondly, multi-line comments, which begin with /* and end with */, commenting out everything between them. Nesting multi-line comments is not supported; thus, /* /* */ */ raises a syntax error because the comment ends with the first */, and the second occurrence is unexpected.