Outline


Comments

/* Comment Block */
// Comment until end of line

Numbers

All digits can be separated by _

Integer

1234    // base 10
0b10101 // base 2
0xF0    // base 16
0o775   // base 8

Float

12.12
0.1
1e9

Glyphs

Characters

A single UTF-8 glyph

'a'
'Σ'

Strings

A list of UTF-8 glyphs

"Hello Word\n"

Tags

All operations return a Result, a result is a transient union composed of tags

A Result typically takes the form

[TYPE`value; Error`error]

Asserting

$a /`value $b

This asserts that the operation will return the value tag. An error is created and returned if it does not

Matching

match $a / $b {
    `value [$v] { ... }
    `error [%e] { ... } // divide by zero
}

Default

$a / $b

If no tag is specified, the `value tag is assumed

Operators

No precedence, evaluated from right to left

3 * 2 + 1 // evaluates as 2 + 1 -> * 3

Calling Operators

All operators can be call like a function

*(3; 2) + 1

Lists

All lists act on a target

Statements in a list are separated by ; or \n. ; and \n are interchangeable

Data TARGET {}

Can be a list of data or list evaluated from left to right, top to bottom depending on the target

Apply TARGET ()

Apply statements to a target

Define TARGET []

Define a target

Keywords

Built in word starting with special meaning. The first character is a lowercase letter [a-z]

true

false

Variables

All variables start with a sigil

Mutable Value $

Mutable and can be passed as message

Mutable Container @

Mutable and cannot be passed as message

Message Container %

A mutable container that can be passed as a message

Constant #

Immutable and can be passed as message

Types

Starts with an uppercase letter [A-Z]

Control Flow

if

case

while

match

Functions

Function have implicit return

#fn : Fn[I64 $x; I64 $y][I64`value] { $x + $y }
#fn : Fn[I64 $x; I64 $y] { $x + $y } // same as above with infered result

return

Generators

Generators have implicit return

#gen : Generator[U64 $n; U64 $y] { while $n <= $y { yield $n; $n +: 1 } }

yield

return

Iterators

Created from a generator

each

Services

#serv : Service[I64 $v] {
    $n : $v
    method #set : Fn[I64 $x] { $n : $x }
    method #get : Fn[] { $n }
}

method

A method is how a service communicates with other services

Processes

Created from a service

Modules

export

import

Namespaces

Access C code

use