Syntax
Keywords
Any identifier that is used in a syntactical element cannot be used as a lexical identifier such as a function or variable name.
Comments
Comments are denoted with two forward slashes. The comment lasts until the end of the current line. There are no multiline comments. It is customary but not necessary for comments to end in full stops.
Identifiers
Identifiers may contain any alphanumeric characters, underscores and any unicode characters that are not whitespace. They cannot consist entirely of numeric digits. These are all valid identifiers:
Identifiers can also contain prime tokens after the first character.
The prime token cannot exist as a prefix or stand alone in an identifier.
Blocks
Lexical blocks are denoted through indentation levels.
Indentation levels use tabular characters and not spaces. The indentation must consist of a contiguous set of tabular characters at the start of the line.
Functions
Functions always begin with the fn
keyword. The set of parameters may be empty to denote a function that does not take in any arguments. The return type may be omitted if the function returns the unit type:
The function signature must end with a colon to denote the beginning of the function body. The body consists of a single expression which may be a block.
Structures
Structures begin with the data
keyword. A colon is used to denote the beginning of the structure body. Each field except the last must end with a list separator. The body ends when the block closes.
The structure fields may all be placed on the same line. In this case, the body ends when the line ends.
Last updated