Loment

Loment

A systems programming language. It emits native x86-64 executables — Linux ELF, Windows PE, or a freestanding object for bare metal — with no runtime and no libc. The toolchain is itself written in Loment.

Download Get started

module hello fn _start() {    let s: str = "hello from Loment\n";    syscall4(1, 1, str_ptr(s) as u64, str_len(s) as u64);    syscall4(60, 0, 0, 0);}

$ loment run hello.lomt
hello from Loment

_start is the entry point, because there is no runtime to call one for you. There is no printf either — output goes through the write system call.

Who can run what, in what scope

Most languages answer what can this program do? Loment is arranged around a narrower question — who can run what, in what scope, and can that be settled without reading the source? The rest of the language exists to keep that question answerable.

module native_cap capability blk_write : disk[0..4] revocable fn write(slot: u32) -> u32 {    guard blk_write(slot);    return slot;} fn literal_ok() -> u32 {    guard blk_write(2);    return 2;}

Line 3 declares the range a unit may reach. Line 6 checks slot against it at run time, where an out-of-range index traps. Line 11 is a literal, so the compiler settles it and nothing is emitted.

Capability domains

A unit declares the range it may reach, and a guard checks an index against it — at compile time when the index is a literal, otherwise at run time. The boundary is stated rather than glossed: a guard bounds the index, not the subject.

Form objects

Every unit exports a declared, machine-readable summary of what it contains and what it reaches, judged by two independent validators — so "what can this touch" is answerable without reading the source.

A compat layer

Ten languages' libraries, callable end to end: C, C++, Rust and Zig behind the C ABI by static linking, then Go, Python, Java, JavaScript, Perl and Lua over a process bridge. Dynamic libraries and embedding a runtime are not started.

What else is different

Written in six other syntaxes

C, C++, Java, C#, Go or Python. Only the spelling changes; the meaning is always Loment's — it is a syntax, not a semantics, and each front end says so on its first line.

A library you import one module at a time

lompi/store/ ships with the toolchain: a standard library and a host layer, reached as use vec, use map, use fs. Per module is the intended way — a package-wide import is slow and collision-prone, and says so in the documentation.

A project mode, not a crate attribute

choose std or choose no_std, at most once, in the root unit. "Hosted or freestanding" becomes a property of the whole program — the compiler can refuse a half-hosted one.

Everything is customizable

The source suffix, the command surface, the libraries — a directory whose identity is a content hash — and the toolchain itself. There is no registry; the extension points are files on disk.