Skip to content

Get the oxl toolchain

Requires: a C compiler (cc) and pthreads; oxl build/run emit C and link through it. Programs that use the sqlite3 shims also need sqlite3 dev headers. The release tarball ships for Linux (x86_64); macOS (aarch64) and Windows (x86_64, via MinGW gcc or LLVM clang) are supported platforms that build from source. See the README.

  1. Install the toolchain and put it on PATH (see Install for releases and the version manager):

    Terminal window
    curl -fsSL https://raw.githubusercontent.com/oxidean/oxl/main/scripts/install.sh | sh
    export PATH="$HOME/.oxl/bin:$PATH"
  2. Try the bundled hello world — installed toolchains carry std/ and examples/ under ${OXL_HOME:-~/.oxl}/versions/<tag>/oxl-toolchain/. Ask the shim which tag is actually resolved — it may differ from default-version when OXL_TOOLCHAIN, a .oxl-version file, or a toolchain directive in oxl.mod selects another — then run the example out of that one toolchain:

    Terminal window
    if cur=$(oxl toolchain current); then
    tag=${cur%% *}
    oxl run "${OXL_HOME:-$HOME/.oxl}/versions/$tag/oxl-toolchain/examples/hello.oxl"
    fi
  3. Write and run your own program. import "std/x" resolves against std/ next to the binary. Every file starts with a package clause, and package main marks an executable:

    hello.oxl
    package main
    fn main() {
    println("hello, oxl")
    }
    Terminal window
    oxl run hello.oxl # compile + run
    oxl build hello.oxl # → native binary

oxl build and oxl run invoke a C compiler for the final link. The driver probes cc → gcc → clang (MSVC’s cl can’t take the emitted C). Set LANG_CC to override, LANG_LDFLAGS to append link inputs (FFI shim objects, libraries), and LANG_SQLITE_SRC to point at an amalgamation sqlite3.c where no dev package exists.

On macOS, Windows, or any platform without a tarball, build the toolchain from the repository (a C compiler plus pthreads):

Terminal window
git clone https://github.com/oxidean/oxl && cd oxl
# resolve the latest published release tag via /releases/latest (curl
# only, no auth); skip the checkout to build `main` instead:
TAG=$(curl -sL -o /dev/null -w '%{url_effective}' \
https://github.com/oxidean/oxl/releases/latest | sed 's|.*/releases/tag/||')
git checkout "$TAG" && bash scripts/stage0.sh
# binary: target/oxl; put it on PATH with std/ alongside

import "std/x" resolves against std/ next to the binary, so run it from the repo root or copy std/ next to wherever the binary lands.

oxl build [<pkg dir>|<file.oxl>...] [-o out] compile to a native binary
oxl run [<pkg dir>|<file.oxl>...] compile + run
oxl test [<pkg dir>|<file.oxl>...] run all fn test_*() in a scope each
oxl fmt <file.oxl>... canonical AST pretty-print (comments kept)
oxl doc <file.oxl> /// comments → markdown
oxl get <path>@<query> fetch + pin a dependency (needs git)
oxl mod <init|tidy|verify|list> maintain oxl.mod / oxl.sum
oxl list -m all the MVS-selected module build list
oxl lsp stdio LSP: diagnostics, hover, goto-definition

oxl get, oxl mod, and oxl list -m are the package/module system: projects opt in with an oxl.mod manifest at the root. The language page covers manifests, resolution, and the module cache.