A language a checker can refuse
Models write it. The compiler runs the examples.
Lingua is a small language in the Python and TypeScript mold (fn, match, List<T>, double-quoted strings, blocks closed with end). Source files are .lf. Every function except main has an example above the body, and the compiler runs it. Nominal types and bounded integers do not interchange. Expected failures are Result. assert and fail do not catch. lingua build emits one static linux/amd64 executable. The normative spec is docs/lingua1.md in the compiler repository.
- Extension
- .lf
- Examples
- Required, and executed
- Types
- Nominal
- Integers
- Bounded
- Output
- One static binary
- License
- CC0
01 — Language
Rails the checker enforces
Example before the body
Every function except
mainhas an example above the body, and the compiler runs it.Named closers
A declaration closes with its kind and name, as in
end fn factorial.Bounded integers
An integer type has an inclusive range, and a tighter range is not introduced implicitly.
Nominal types
type CustomerId = Textandtype Cursor = Textdo not unify.Closed matches
A
matchon a closed type has to cover every variant.Declared effects
A function declares its effects, and
puredeclares none.Comptime
An ordinary function runs at compile time when the call is marked
comptime.check,fmt,pack,buildlingua checktypechecks and runs examples,lingua fmtrewrites source into canonical layout,lingua packprints a file with the signatures it needs, andlingua buildemits one static linux/amd64 executable.
02 — Pipeline
Six columns from one program
Captured from the factorial program in the compiler's end-to-end tests.
Tokens
The lexer prints one token per line, with its line and column.
AST
The parser prints the untyped tree as an S-expression.
TIR
The typechecker prints the typed IR, with a type on every expression.
LIR
Build lowers the checked program into this form.
Assembly
The linux/amd64 backend selects these instructions.
Run
The sample prints 0! through 5!, then 20!.