Files and syntax
Source files
Section titled “Source files”- Extension
.aph, UTF-8. Outside string literals only printable ASCII and LF are allowed. - LF line endings only. No tabs, no trailing spaces, no empty lines, exactly one final LF.
- One file is one module. Imports arrive in v0.2.
Tokens
Section titled “Tokens”Tokens are separated by exactly one space. Line structure matters: a line at column 0 starts a top-level item, a line starting with exactly one space is a body line of the preceding fn.
| Class | Form | Notes |
|---|---|---|
| identifier | [a-z][a-z0-9]* |
no _, - or uppercase |
| integer | 0 or -?[1-9][0-9]* |
-5 is a literal, - a b is subtraction |
| float | -?[0-9]+\.[0-9]+ |
|
| string | "..." |
escapes \n \t \" \\ only |
| function reference | @f |
a function as a value |
| field | .f |
field access, arity 1 |
| parameter | x:T |
in fn headers, no space around : |
| list | [1 2 3] |
brackets attach to the first and last element |
| operator | + - * / % == != < <= > >= |
Keywords: fn type use let do ex doc if try some none ok err else has isok empty nil true false and or not neg. Their spellings are provisional: they will be tuned against real tokenizers.
Canonical order
Section titled “Canonical order”A file is a sequence of items in this order:
useitems, sorted by their full line text.typeitems, sorted by name.fnitems, sorted by name, withmainalways last.
The text is the canonical printing of the AST. aleph fmt prints it, and aleph check rejects any file that differs (F001), including the canonical text in the diagnostic.