Get started
This page is only about getting a program to run. For what the language is, see the front page.
Install it
Loment ships as a package. Take the archive for your platform from the latest release.
Linux / WSL
A linux-x64.tar.gz. Unpack it and run sh install.sh.
POSIX sh is the only requirement.
Windows
A windows-x64.zip — unpack it and run
powershell -File install.ps1 — or a
windows-x64-setup.exe you double-click.
You get the loment command, lompi, and the language server.
Compiling and running needs no Python, no clang and no WSL: the
package is native binaries plus the standard library, and the installer checks
SHA256SUMS before it writes anything.
To change the language itself rather than use it, work from a checkout instead:
git clone https://github.com/FujoJTOP/loment.git. The compiler is
written in Loment and rebuilds from a seed committed to the repository —
sh loment/bootstrap.sh builds it and checks that the seed reproduces
itself byte for byte.
Write a program
Put this in hello.lomt.
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);}
_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, whose arguments are the file descriptor, the
string's pointer and its length. The second call is exit.
Compile and run it
$ loment run hello.lomt # compile, link, run$ loment build hello.lomt -o hello$ loment check hello.lomt # check only, nothing written$ loment ir hello.lomt # the LLVM IR it generates
On Windows the target is PE, so name the output .exe — the linker picks
the format from that name.
Look around the language
The toolchain explains itself. These four carry most of it.
$ loment example tour # the whole language in one file$ loment cheat # the traps, ordered by how easily they bite$ loment builtins # every built-in function there is$ loment syntax # syntax summary
loment example tour prints the whole language as one commented source
file. Its comments are in Chinese, and on 0.1.4 that particular file does
not link; the four programs on Examples are the ones
verified to run.