Getting started
dusk is a small systems language that compiles to native code. This page gets the toolchain onto your machine and takes you from an empty file to a running program.
If you want to try the language before installing anything, the playground runs dusk in the browser.
Requirements
Section titled “Requirements”- clang and LLVM 22.x on your
PATH. The compiler emits textual LLVM IR that targets one LLVM major version, so the version matters. - Rust stable and Cargo, if you install from crates.io or build from source.
Install
Section titled “Install”dusk is pre-1.0 and every minor release changes the language. Installing today means tracking a moving target, which the development packages make explicit.
# from crates.iocargo install dusk-lang
# on Arch Linux, from the AUR, builds the latest mainparu -S dusk-lang-gitBoth install two binaries: dusk, the compiler, and dawn, the package tool. Verify the install:
dusk versionThis prints dusk 0.3.3 (or whichever version you installed).
You can also work directly from a clone of the repository: cargo run --bin dusk -- run <file> compiles the toolchain on first use and runs it in one step, or cargo build --release puts standalone binaries in target/release.
Hello, world
Section titled “Hello, world”Create a file named hello.dusk:
@paradigm procedural
@import std.io.print_line
func main(argc: int32, argv: string[]) -> int32 { print_line("hello, world") return 0}Run it:
dusk run hello.duskhello, worldA few things to notice:
@paradigm proceduralis required. Every dusk file declares one paradigm (procedural,functional, oroop), and that choice gates which builtins the file can use. See Paradigms.@import std.io.print_linepulls one symbol from the standard library’siomodule. The stdlib is itself written in dusk; see the stdlib overview.mainreturnsint32, which becomes the process exit code.dusk runforwards any trailing arguments to the program, so amaindeclared withargcandargvsees them.
The dusk CLI
Section titled “The dusk CLI”The dusk binary has eight commands:
| Command | What it does |
|---|---|
dusk run <file> | Compile and run |
dusk build <file> | Compile to a native binary |
dusk check <file> | Lex, parse, resolve names, and type check without emitting code |
dusk parse <file> | Lex and parse, dump the AST |
dusk scan <file> | Dump paradigms and imports (pre-scan) |
dusk lex <file> | Dump the token stream |
dusk demo | Build and run a hardcoded IR spine as a toolchain smoke test |
dusk version | Print the version |
For day-to-day work you mostly need run, build, and check. Full details are on the CLI page.
For programs that import packages over git, use dawn instead. dawn run <file> fetches the imports and then compiles and runs. See dawn.
DUSK_HOME
Section titled “DUSK_HOME”The compiler finds its standard library and C runtime beside itself: in the share directory for a packaged install, or inside the cargo registry checkout for cargo install. The DUSK_HOME environment variable overrides that search when you want a binary to use a different toolchain tree, such as a source checkout:
DUSK_HOME=/path/to/dusk-checkout dusk run hello.duskWhere to go next
Section titled “Where to go next”- Language tour: the core of the language in one pass.
- Paradigms: how per-file paradigm gating works.
- Memory: manual allocation, managed pointers, and the generational heap.
- Errors: errors are values you handle.
- Examples: runnable programs, from hello world to a multi-module app.
- Reference: the precise rules.