Skip to content

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.

  • 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.

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.

Terminal window
# from crates.io
cargo install dusk-lang
# on Arch Linux, from the AUR, builds the latest main
paru -S dusk-lang-git

Both install two binaries: dusk, the compiler, and dawn, the package tool. Verify the install:

Terminal window
dusk version

This 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.

Create a file named hello.dusk:

hello.dusk
@paradigm procedural
@import std.io.print_line
func main(argc: int32, argv: string[]) -> int32 {
print_line("hello, world")
return 0
}

Run it:

Terminal window
dusk run hello.dusk
hello, world

A few things to notice:

  • @paradigm procedural is required. Every dusk file declares one paradigm (procedural, functional, or oop), and that choice gates which builtins the file can use. See Paradigms.
  • @import std.io.print_line pulls one symbol from the standard library’s io module. The stdlib is itself written in dusk; see the stdlib overview.
  • main returns int32, which becomes the process exit code. dusk run forwards any trailing arguments to the program, so a main declared with argc and argv sees them.

The dusk binary has eight commands:

CommandWhat 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 demoBuild and run a hardcoded IR spine as a toolchain smoke test
dusk versionPrint 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.

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:

Terminal window
DUSK_HOME=/path/to/dusk-checkout dusk run hello.dusk
  • 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.