A statically-typed scripting language with null safety, built-in collections, and parallel execution.
struct Point { x: float, y: float }
fn distance(a: Point, b: Point) -> float {
dx = a.x - b.x
dy = a.y - b.y
sqrt(dx * dx + dy * dy)
}
fn main() {
p1 = Point { x: 0.0, y: 0.0 }
p2 = Point { x: 3.0, y: 4.0 }
println("distance: {distance(p1, p2)}")
}
$ loft hello.loft
distance: 5.0
- Static types — every variable has a type inferred at first assignment; mismatches are compile errors
- Null safety — all values are nullable by default; arithmetic propagates null; use
?? defaultto recover - Structs and enums — struct-enum variants with per-variant method dispatch (polymorphism without vtables)
- Collections —
vector<T>,sorted<T>,index<T>,hash<T>with iterator loop attributes - String formatting —
"{expr}"interpolation with format specifiers ({x:06.2}) - Parallel for —
for a in items par(b=worker(a), threads) { ... }distributes work across CPU cores - Structured logging —
log_info/log_warn/log_errorwith source location and rate limiting - File I/O — read, write, seek, directory listing, PNG images
- Rust integration — emit typed Rust code from loft type definitions via
gendoc
git clone https://github.com/jjstwerff/loft
cd loft
cargo build --release
# binary is at target/release/loftcargo install --git https://github.com/jjstwerff/loft --bin loftDownload a release binary from the Releases page (Linux x86-64, macOS Intel, macOS ARM, Windows x86-64).
loft [options] <file.loft>
Options:
--help Show this help
--version Print version
--path <dir> Override the project root (where default/ is found)
The interpreter loads the standard library from default/ relative to the binary, then
parses and executes <file.loft>. The entry point is fn main().
The user documentation is generated HTML — run cargo run --bin gendoc to build it,
then open doc/index.html in a browser. A single-page version is at doc/print.html
and a printable reference at doc/loft-reference.pdf.
Language tutorial (each page is also a live test):
| Page | Topic |
|---|---|
| Loft Language | First program, core concepts |
| Keywords | Control flow: if, for, break, continue |
| Texts | Strings, slicing, iteration |
| Integers | Arithmetic, bitwise, null |
| Functions | Parameters, return, fn-refs, map/filter/reduce |
| Vectors | Dynamic arrays, comprehensions, clear |
| Structs | Fields, methods, sizeof |
| Enums | Variants, polymorphism, match expressions |
| Collections | Sorted, Index, Hash |
| Libraries | Imports, wildcard imports, extending types |
| Parallel | par(...) for-loop parallelism |
| Safety | Language traps and how to avoid them |
Standard library API: doc/stdlib.html
For contributors: doc/DEVELOPERS.md — feature proposals, quality gates, diagnostic guide
- No lambda expressions — anonymous functions are planned for 1.1
- No REPL — interactive mode is planned for 1.1
- No in-place vector sort —
sorted<T>keeps insertion order; asort()function is planned for 1.1
LGPL-3.0-or-later — see LICENSE.