View on GitHub

Nexus Language

A LLM-friendly language

CLI

Commands

nexus run [FILE|-]

Interpret a Nexus source file:

nexus run program.nx
nexus run --allow-console --allow-fs program.nx
echo 'let main = fn () -> unit do return () end' | nexus run -

Supports stdin piping and shebang scripts.

nexus build [FILE|-]

Compile to a WASM component:

nexus build program.nx                  # outputs main.wasm
nexus build program.nx -o output.wasm   # custom output path

Requires wasm-merge for dependency bundling. Configure via:

Resolution order: --wasm-merge > NEXUS_WASM_MERGE > wasm-merge from PATH.

Inspect declared capabilities:

nexus build program.nx --explain-capabilities       # human-readable
nexus build program.nx --explain-capabilities=json   # machine-readable

Run the built component:

wasmtime run -Scli main.wasm
wasmtime run -Scli -Shttp -Sinherit-network -Sallow-ip-name-lookup -Stcp main.wasm

nexus check [FILE|-]

Parse and typecheck only. No execution, no WASM output.

nexus check program.nx

REPL

Run nexus with no arguments to start an interactive session:

nexus

Capability Flags

Flag Permission Description
--allow-fs PermFs Filesystem access
--allow-net PermNet Network access
--allow-console PermConsole Standard I/O
--allow-random PermRandom Random number generation
--allow-clock PermClock Clock and timers
--allow-proc PermProc Process control
--preopen DIR (with PermFs) Preopen a directory for filesystem access

Capability flags apply to nexus run. The compiled WASM binary encodes required capabilities in the nexus:capabilities section – the host runtime (e.g., wasmtime) enforces them at execution time. See WASM and WASI.

Development

Build and run from source:

cargo run -- run program.nx --allow-console
cargo run -- build program.nx
cargo run -- check program.nx