Skip to content

Commands and projects

Run nerv --help for the command list or nerv COMMAND --help for command options. Project commands search the current directory and its parents for Nerv.toml.

Everyday commands

Command Purpose
nerv new hello Create an application in a new directory.
nerv new --lib math Create a library with src/lib.nerv.
nerv check Check project source and integration-test files.
nerv test Run test blocks in source and tests/.
nerv run -- args Build and run, passing arguments after --.
nerv build --release Build an optimized standalone executable.
nerv fmt Format project source and tests.
nerv fmt --check Report formatting changes without writing files.

new refuses an existing directory. Package names use ASCII identifiers and cannot be nerv. Single source files work too: nerv run hello.nerv and nerv check hello.nerv.

Project configuration

[package]
name = "hello"
version = "0.1.0"
entry = "src/main.nerv"
lib = "src/lib.nerv"

[dependencies]
math = { path = "../math" }

entry and lib are optional and default to the paths above. The files need exist only for the targets you use: a library-only package can have just src/lib.nerv. Source paths must stay inside the package. Package versions currently have three numeric components.

Local dependencies need their own manifest and library source. import math loads the library; import math.extra loads its extra.nerv module. Cycles and unsupported manifest keys are errors. Remote dependencies and version constraints are not implemented.

Commit Nerv.lock. It records resolved local package manifests, versions, relative paths, dependency edges, and manifest hashes. --locked rejects missing or stale locks. Source changes do not require a new lock; manifest changes do. Preserve relative package locations, and keep dependencies on the same filesystem volume.

Build options

Option Applies to Purpose
--manifest-path path/Nerv.toml Project commands Select a project explicitly.
--locked Check, test, build, run Use the lockfile without changing it.
--debug / --release Build, run Select build mode; debug is the default.
--cpu generic / --cpu native Build, run Use generic CPU features or specialize for this host.
-o path Build Choose the executable output path.
--no-cache Build, run Regenerate cached object code.

Executables normally go under target/nerv/debug/ or target/nerv/release/ and use the package name, plus .exe on Windows. Removing target/ clears build output and caches. A library-only package supports check and test; build and run need an application entry with main.

Exit status and arguments

With project commands and nerv run file.nerv, an integer main becomes the exit status modulo 256; a void main exits 0. The result is not printed automatically. Runtime failures exit 1. nerv run forwards the application's exit status, and build messages go to standard error.

arguments() includes the executable at index zero. Use nerv run -- get NAME, with -- before the application's arguments. Historical nerv file.nerv --run is a different, result-printing mode; use the project commands in these guides.

Detailed references

The compiler repository maintains additional technical documentation:

These guides describe the complete 1.0 distribution. Older development-history sections in repository documents may describe earlier packaging requirements.