Blocks

FOL’s all possible code blocks:

DECLARATION

Variable

var one = <expression>;
~var one = <expression>;
~var one: int = <expression>;
~var[] one: int[] = <expression>;
~var[opt,opt] one: int[opt,opt] = <expression>;
~var[] (
    one: int[] = <expression>;
    two: int[] = <expression>;
)
~var[] one, two, three: int[] = <expression>;
~var[] one, two, three: int[], flt[], bol[] = <expression>;

Functions

fun one(two: int): int = { <expression> }
~fun one(two: int): int = { <expression> }
~log[] one(two: int): int = { <expression> }
~fun[] '!='(one, two: int): bol = { <expression> }
~pro[] (obj)one(two: int): int = { <expression> }
~pro[] (obj)'$': str = { <expression> }
~pro[] one[T: gen](two: int): int = { <expression> }

Types

typ user: rec = { <expression> };
~typ[] (
    one: rec[] = <expression>;
    two: rec[] = <expression>;
)
~typ[] user: rec = { <expression> };
~typ[] user: rec[] = { <expression> };
~typ[] user(blue): rec[] = { <expression> };
~typ[] user(T: gen, N: int)(blue): obj ;
~ali[] five: arr[int, 5];
~ali[] int: int;

Packages

use[] one: two = <expression>;
~use[] one: two = <expression>;
~use[] (
    one: two = <expression>;
    two: two = <expression>;
)

Macros

def '$'(a: any): mac = '.to_string($)'
def '~var': alt = 'var[~]'
def 'str': def[] = 'str[new,mut,nor]'

CONTROL

Choice

when(condition){ case (condition){} case (condition){} * {} };
when(variable){ is (value){}; is (value){}; * {}; };
when(variable){ in (iterator){}; in (iterator){}; * {}; };
when(iterable){ has (member){}; has (member){}; * {}; };
when(generic){ of (type){}; of (type){}; * {}; };
when(type){ on (channel){}; on (channel){}; };

Loops

loop(condition){};
loop(iterable){};

LITERALS

Function

[a, b: int]{ <expression> }

Constructs

[name]{ <expression> }