1. Installing, and the first program

  • chapter 1 of 20
  • 2 min read

Follow the installation instructions to download one release tag and verify its checksums and native metadata. Choose the entry point explicitly:

Entry pointWhat runs
Installed dawnThe native C backend on Linux x86_64, with std and the runtime embedded. It refuses use java.
Checkout ./bin/dawnThe JVM bootstrap driver, which builds the compiler from source. Requires JDK 21 or newer.
java -jar /absolute/versioned/dawn-selfhost.jarA verified release's JVM toolchain, with std embedded. Requires JDK 21 or newer, including on platforms without a native release.

The commands below use installed dawn. Native run, build and test need a C compiler; package downloads need curl, and WebAssembly needs clang and WASI. To use a checkout, replace dawn with ./bin/dawn; for an explicit JVM release, replace it with java -jar /absolute/versioned/dawn-selfhost.jar. The installed command does not choose Java after a failure. Putting a checkout's bin first on PATH selects that checkout's JVM driver.

dawn run  hello.dawn        # compile and run
dawn test hello.dawn        # run the test blocks in the file
dawn fmt  hello.dawn        # format the file in place

From source, if you have a checkout and JDK 21: ./bin/dawn stands in for dawn. Its first run downloads the seed (the dawn-selfhost.jar of the release pinned by scripts/seed-release.txt, checked against scripts/seed-checksums.txt) and compiles the compiler in selfhost/ with it. There ./bin/dawn build hello.dawn --native -o hello packages the JVM build with GraalVM native-image. Installed dawn build hello.dawn -o hello instead builds through C and does not accept --native.

For VS Code, the default settings start dawn lsp. Set dawn.lspPath to a checkout's absolute bin/dawn path to use that JVM driver. For an explicit JVM release, set dawn.lspPath to java and dawn.lspArgs to ["-jar", "/absolute/versioned/dawn-selfhost.jar"]; JDK options go before -jar. The extension appends lsp, passes literal argv elements without a shell, and restarts when either setting changes. See editor integration for Neovim and Helix argv arrays.

The first program. Functions are pure by default; touching IO — printing, here — requires !io on the signature:

pub fn main() -> Unit !io =
  println("Hello, Dawn")
Hello, Dawn

String interpolation is written ${expr}, for a plain variable as much as for any expression (the value interpolated has to be printable). Braces on their own are ordinary characters — without a $ there is no interpolation:

pub fn main() -> Unit !io = {
  let name = "Dawn"
  let year = 2026
  println("${name} was born in ${year}")
}
Dawn was born in 2026

See also: spec.en.md §12.1