Demos
Real programs, not just snippets
The tour shows the language one feature at a time. nlvm-demos is a companion repository of small, complete, runnable NL programs — clone it, build with nlc, run with nlvm.
$ git clone https://github.com/nlvm-lang/nlvm-demos
$ cd nlvm-demos/01_hello_world && make
06 · Flagship demo
A multi-threaded HTTP server
One OS thread per connection, via system.thread.Thread — requests are handled in parallel, not queued behind each other. Shared state (a request counter, a connection counter) lives on one Server instance and is guarded by a system.thread.Mutex, because every worker thread shares the same heap object.
The served page polls /api/stats for a live request count, and has a "fire 5 parallel requests" button that hits a deliberately slow endpoint five times via Promise.all. On a single-threaded server that's ~3 s; here it's ~600 ms, because five threads sleep at once instead of one thread sleeping five times — parallelism you can watch happen in a browser tab.
public void handle(system.net.TcpStream stream,
int connId) {
try {
byte[] buf = new byte[8192];
int n = stream.read(buf, 0, buf.length());
string request =
system.text.Encoding.decodeUtf8(buf.slice(0, n));
string[] parts = request.split("\r\n")[0].split(" ");
string path = parts[1];
int count = this.recordRequest(); // mutex-guarded
if (path == "/api/work") {
// proves requests run in parallel, not queued
system.thread.Thread.sleep(600);
this.sendResponse(stream, 200, "OK",
"application/json; charset=utf-8",
"{\"worker\": " + connId + "}");
}
// ...whitelist-routed static files below
stream.close();
} catch (Exception ex) {
system.Err.println("[worker " + connId + "] " + ex.message);
stream.close();
}
}
01 – 05
The rest of the set
Five smaller programs, each isolating one corner of the language.
◆01 · Hello world
Minimal single-file program: class Main, static main, system.Out.print.
◆02 · Shapes
Multi-file program: abstract classes, inheritance across files, Stringable, generics (system.List<T>), exceptions with stack traces.
◆03 · Store
Four separate namespaces ("workspaces") in their own folders, cross-namespace use imports, exceptions crossing namespace boundaries.
◆04 · Scoreboard
Closures and anonymous functions, built-in array methods (filter/sort/forEach/map/find), exhaustive match, ?? coalescing.
◆05 · Priority
Typed int-backed enum with custom instance methods, from/tryFrom, ?? fallback on parse failure.
Run one yourself
Every demo assumes nlc/nlvm are already built — see Get started if you haven't.