Landin
Ada, but small. Zig, but sweeter. One systems language from 32 KB to 32 TB*. Move fast, keep the pointers, and let the compiler tell you when you are being an idiot.
Named after Peter Landin, who coined the term "syntactic sugar" and wrote "The Next 700 Programming Languages". This one is the 701st.
status · version 0.2.11 · Linux, macOS, FreeBSD, Cortex-M, RV32, Xtensa · roadmap →
What it looks like
A whole program that prints one line, saved as main.ldn, compiled and run:
import core/io import hosted/blocking public main: () -> (code: i32) = host := blocking.new() io.write(host, io.out(host), "Hello, world!\n") else none code = 0 end main
$ refine compile main.ldn -o hello && ./hello Hello, world!
Start here
A larger one
Sensors of two kinds behind one concept, polled through runtime dispatch. The poll is generic over its allocator, which the caller lends as an arena over a stack buffer; each failure is declared in a signature and either skipped or passed on at the call. This is the whole file; it compiles and runs as shown.
-- Sensors of different kinds behind one concept, polled through `any`, -- their readings kept in a list whose memory the caller lends. import core/arena import core/io import core/mem import core/vec import hosted/blocking offline: atom jammed: atom sensor: type = concept (t: type) read: (self: ptr mut t) -> (value: i32) ! offline | jammed end sensor thermometer: type = struct celsius: i32 end thermometer door: type = struct openings: i32 wired: bool end door read_thermometer: (self: ptr mut thermometer) -> (value: i32) ! offline | jammed = fail jammed when self.val.celsius < -40 value = self.val.celsius end read_thermometer read_door: (self: ptr mut door) -> (value: i32) ! offline | jammed = fail offline when not self.val.wired inc self.val.openings value = self.val.openings end read_door thermometer is sensor (read: read_thermometer) door is sensor (read: read_door) --- Generic over where the memory comes from; the caller decides. poll: (provider: type is mem.allocator, memory: provider, sensors: []mut any sensor) -> (readings: vec.list(i32)) ! mem.out_of_memory | jammed = readings = vec.new(item: i32) for device in sensors do -- An unplugged sensor is skipped; a jammed one stops the poll. value := device.read() else (why) fail jammed when why == jammed continue end try vec.push(readings, memory, value) end for end poll public main: () -> (code: i32) = host := blocking.new() mut storage: [256]u8 = zeroed mut out := io.buffered_over(host, io.out(host), storage) defer io.flush(out) else none -- The readings live in an arena over 256 bytes of this frame. mut bytes: [256]u8 = zeroed mut space: arena.space = zeroed bump := arena.over_unchecked(space, addr bytes[0], lenof bytes) mut kitchen: thermometer = (celsius: 21) mut hall: thermometer = (celsius: 19) mut front: door = (openings: 1, wired: true) mut cellar: door = (openings: 0, wired: false) mut sensors: [4]any sensor sensors[0] = any(addr kitchen) sensors[1] = any(addr front) sensors[2] = any(addr cellar) sensors[3] = any(addr hall) mut readings := poll(bump, sensors[0..<4]) else (problem) if problem == jammed then io.put(out, "a sensor is jammed\n") else none else io.put(out, "out of memory\n") else none end if code = 1 return end defer vec.release(readings, bump) for value in vec.used(readings) do io.format(out, "read {}\n", [any(addr value)]) else none end for count: usize = vec.length(readings) io.format(out, "{} of 4 sensors answered\n", [any(addr count)]) else none code = 0 end main
$ refine compile main.ldn -o sensors && ./sensorsmore programs →Status and roadmap
Every document
01 · the language
#include to exit, in its Landin form, and the habits with no answer yet.7 sectionsthe library referenceEvery module's calls and signatures, with common tasks as one complete program and each module's own example.how the documents are arrangedWhere each kind of rule lives in the specification and the tour, where a new one goes, and what the arrangement is and is not evidence of.4 sections02 · the project
03 · the compiler
refine explain prints.7 sectionshow a source is laid outThe one layout refine fmt gives every source: each rule with a program as written and as formatted.2 sectionswhat the language server answersrefine lsp: where a file belongs, what each request is answered with, and how far it reads past a syntax error.8 sectionswriting a command for refineWhat a contributed refine-NAME answers: its description, its words, help, completion and explanations, with a complete example.4 sectionstarget contractsTarget descriptions, ABI capabilities, symbol spelling and backend boundaries.20 sectionsthe core modulesExplicit allocator capabilities, collections and the constrained CPU library, with their module boundaries.6 sectionsC binding policiesThe binding generator's invocation, complete policy schema and generated C boundary.6 sectionsthe pinned toolchainOne compiler, recorded exactly, with the warning policy and the checksums that verify it.11 sectionseditor and IDE supportInstallable Landin highlighting for Zed, VS Code, Neovim, Vim, Emacs, Helix and the other major editor families, and the language server each of them starts.7 sections04 · tests and evidence
05 · design stress tests
*32 TB is an unverified goal. What it measures at the hosted end, and what evidence would prove it, are still open, and nothing hosted today establishes it. Terabytes may vary.