Syntax
Notation
| Notation | Example | Description |
|---|---|---|
TypeWriter | if | The exact character(s) |
| Italic | Identifier | A syntactical production |
| x ::= y | Null ::= null | Definition of a syntactical production |
| x y | spawn Expression | Concatenation 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 | y | true | false | Either 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:
| Syntax | Name |
|---|---|
null | Null |
true | false | Bool |
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:
| Syntax | Name |
|---|---|
| Value | Value |
| ScopedIdentifier | Variable |
<- Expression | Receive |
| UnaryOperator Expression | Unary |
| Expression BinaryOperator Expression | Binary |
( Expression ) | Group |
Expression [ Expression ] | Index |
Expression . Identifier | Member |
Expression ( ( ( Identifier : )? Expression , )* ) | Call |
spawn Expression | Spawn |
UnaryOperator ::= - | !
BinaryOperator ::= +| - | * | / | % | ?? | == | != | < | <= | > | >= | and | or
Statement
Statement can be one of:
| Syntax | Name |
|---|---|
Expression ; | Expression |
let Identifier = Expression | Declaration |
Identifier = Expression | Assignment |
Expression <- Expression | Send |
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:
| Syntax | Name |
|---|---|
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.