generatedView source

Alpha grammar

Generated by debug/docs-set.py. Do not edit by hand: this document is derived from the live compiler, so editing it here would only make it disagree with the language.

Lexical structure

  • an identifier begins with a letter and continues with letters, digits, -, /, . or '
  • a comment runs from -- to the end of the line
  • the only delimiters are ( and ); :, . and = are their own lexemes
  • a natural literal is a run of decimal digits

Module grammar

A module is a sequence of line-oriented declarations:

module <qualified-name>
import <qualified-name>        -- must name an earlier module
family <Name> : Type <level>  -- parameters, indices, constructors, fields, then end-family
def <name> [: <type>] = <term>

Families precede definitions. An import must name a module that appears earlier in the closure, so the module graph is acyclic by construction.

Term forms (78)

Every form the edition defines, in the syntax the parser accepts:

formshape
app(app FUNCTION ARGUMENT)
bind(bind EFFECTS RESULT COMPUTATION CONTINUATION)
byte(byte 0..255)
byte-andsee docs/language/SPECIFICATION.md
byte-equal(byte-equal A B)
byte-less-than(byte-less-than A B)
byte-orsee docs/language/SPECIFICATION.md
byte-shift-leftsee docs/language/SPECIFICATION.md
byte-shift-rightsee docs/language/SPECIFICATION.md
byte-string-literalsee docs/language/SPECIFICATION.md
byte-to-nat(byte-to-nat BYTE)
byte-xorsee docs/language/SPECIFICATION.md
bytes(bytes B0 B1 ...)
bytes-append(bytes-append A B)
bytes-builder-append(bytes-builder-append A B)
bytes-builder-build(bytes-builder-build BUILDER)
bytes-builder-chunk(bytes-builder-chunk BYTES)
bytes-builder-empty(bytes-builder-empty)
bytes-checksum(bytes-checksum BYTES)
bytes-cons(bytes-cons BYTE BYTES)
bytes-eliminate(bytes-eliminate MOTIVE BASE STEP SCRUTINEE)
bytes-equal(bytes-equal A B)
bytes-head(bytes-head BYTES)
bytes-index-nonzero(bytes-index-nonzero BYTES INDEX)
bytes-length(bytes-length BYTES)
bytes-set-free-index(bytes-set-free-index BYTES INDEX DEPTH OFFSET)
bytes-set-index(bytes-set-index BYTES INDEX)
bytes-tail(bytes-tail BYTES)
casesee docs/language/SPECIFICATION.md
computation(computation EFFECTS RESULT)
constructor(constructor FAMILY CONSTRUCTOR ARGUMENT ...)
dosee docs/language/SPECIFICATION.md
effect-row(effect-row)
effects(effects E ...)
eliminate(eliminate FAMILY MOTIVE SCRUTINEE (branch C BINDER ... . BODY) ...)
equal(equal TYPE LEFT RIGHT)
f32-addsee docs/language/SPECIFICATION.md
f32-dividesee docs/language/SPECIFICATION.md
f32-equalsee docs/language/SPECIFICATION.md
f32-less-thansee docs/language/SPECIFICATION.md
f32-multiplysee docs/language/SPECIFICATION.md
f32-subtractsee docs/language/SPECIFICATION.md
family(family NAME ARGUMENT ...)
first(first PAIR)
fsucc(fsucc BOUND INDEX)
fzero(fzero BOUND)
ihsee docs/language/SPECIFICATION.md
lambda(lambda QUANTITY NAME : TYPE . BODY)
let(let QUANTITY NAME = VALUE in BODY)
let*see docs/language/SPECIFICATION.md
matchsee docs/language/SPECIFICATION.md
match-withsee docs/language/SPECIFICATION.md
nat-addsee docs/language/SPECIFICATION.md
nat-dividesee docs/language/SPECIFICATION.md
nat-eliminate(nat-eliminate MOTIVE BASE STEP SCRUTINEE)
nat-less-than(nat-less-than A B)
nat-literalsee docs/language/SPECIFICATION.md
nat-modulosee docs/language/SPECIFICATION.md
nat-multiplysee docs/language/SPECIFICATION.md
nat-subtractsee docs/language/SPECIFICATION.md
nat-to-byte(nat-to-byte NAT)
pair(pair SIGMA-TYPE FIRST SECOND)
partial(partial COMPUTATION-TYPE)
pi(pi QUANTITY NAME : TYPE . RESULT)
projectsee docs/language/SPECIFICATION.md
read-file(read-file PATH)
recordsee docs/language/SPECIFICATION.md
refl(refl TYPE VALUE)
return(return EFFECTS VALUE)
runtime-image-v4-build(runtime-image-v4-build BUILDER)
second(second PAIR)
sigma(sigma QUANTITY NAME : TYPE . RESULT)
succ(succ NAT)
text-literalsee docs/language/SPECIFICATION.md
transport(transport MOTIVE PROOF VALUE)
updatesee docs/language/SPECIFICATION.md
write-file(write-file PATH CONTENTS)
zerozero

Quantities

erased, affine, linear, unrestricted. A binder's quantity is part of its type and is enforced by the kernel: a linear binder used twice is a ALPHA-QUANTITY-VIOLATION.

The live inventory behind this document: {}.