Skip to content
Xen / docs

Search documentation

English · v0.1.0-demo.2

Type to search the documentation.

    한국어
    Xen / reference v0.1.0-demo.2

    Command-line tools

    Commands assume xen is on PATH. From a distribution directory, substitute ./bin/xen; from the repository, use compiler/dist/xen.

    CommandPurpose
    xen version or xen --versionShow the installed version
    xen check file.xenFind errors before execution
    xen run file.xenRun immediately
    xen build file.xen -o appMake a standalone executable
    xen test [file.xen or directory or std.module]Run tests

    Successful check and build commands produce no output. Without -o, build writes a.out in the working directory. An existing output file is overwritten. run uses the current working directory and standard input/output, removing its temporary executable when the program exits.

    Terminal window
    xen run word_count.xen -- input.txt
    xen build word_count.xen -o word-count
    ./word-count input.txt

    Before -- are Xen options; after it are your program’s arguments. Read them with std.env.args() or arg_count() and arg(index). The first argument has index 0; the executable name is excluded. An invalid arg index is a runtime error.

    The default target is your installed Xen compiler’s Linux architecture. check, build, run, and test accept --target=x86_64-linux and --target=aarch64-linux. arm64-linux is an alias for the latter.

    Terminal window
    xen build hello.xen --target=aarch64-linux -o hello-arm64

    Run the output on a compatible Linux machine. Selecting another CPU does not automatically make it executable on the current machine. AArch64 support is experimental and validation on physical devices is ongoing. macOS and Windows are unsupported.

    xen test searches the current directory. Narrow names with --filter text. See testing.

    Normal programs can use the defaults. For blocks you explicitly mark as #scope[opt] { ... }, build, run, and test use --opt=basic by default. Disable it with --opt=off. Unmarked code is unaffected.

    --opt-report prints application information to stderr. --opt-cache=directory stores a build cache in that directory. Both require basic and are unavailable for check. These options are optional when learning and using the language.

    StatusMeaning
    0Success
    1Code, runtime, or test error, or no matching tests
    2Invalid command usage

    run propagates the program’s exit status. Panics and ordinary runtime errors usually exit 1. There is no separate --help option. Running xen without arguments prints usage to stderr and exits 2.