Getting started
Install
Section titled “Install”Aleph needs a Rust toolchain (stable) and a C compiler (cc) for native builds.
git clone https://github.com/qursor-it/alephcd alephcargo install --path compilerThis installs the aleph binary. The C runtime is embedded in it, so aleph build works from any folder.
A first program
Section titled “A first program”Create hello.aph:
fn main -> unit print "hello"Two rules show up at once: tokens are separated by exactly one space, and body lines start with exactly one space. There are no parentheses and no empty lines.
aleph check hello.aph # lex, parse, canonical form, types, capabilities, examplesaleph run hello.aph # interpreteraleph build hello.aph -o hello && ./hello # native, through CA program that reads a file
Section titled “A program that reads a file”use fs.read "data"fn words s:str -> i64 ex words "a b c" = 3 len split trim s " "fn main -> res unit str let text try read "data/in.txt" do print show words text ok niluse fs.read "data"is the only file access this program has.ex words "a b c" = 3is an example:aleph checkruns it and fails if it does not hold.tryunwraps the result ofreador returns its error early.
Ask what the program can do without reading it:
aleph explain words.aphcapabilities: fs.read "data"fn words s:str -> i64 effectful: no examples: words "a b c" = 3 builtins: len split trimfn main -> res unit str effectful: yes calls: words builtins: print read showentry: mainRemove the use line and aleph check --json answers with a diagnostic instead of guessing:
{"code":"C001","severity":"error","node":"n7","msg":"missing capability","expected":"fs.read"}