This guide builds the shared Ny/Matrix SDK and exercises its compiler and interpreter. The release profile and standard-library reference describe the supported native routes and API boundaries as the framework approaches v1.
- CMake 3.21 or newer (SDK test reporting uses CTest's
--output-junit) - a C++17 compiler for the SDK itself
- Make, Ninja, or another CMake-supported build tool
- Python 3.12 or newer for the documented Ubuntu 24.04 environment
- Pandoc when packaging the SDK's HTML documentation
- optional LLVM development packages for the LLVM backend
- X11 development headers/libraries on Linux only to enable the experimental
nilagentwindow-control features
Linux is the supported native release target; other hosts remain experimental. On Ubuntu, install the development dependencies with:
sudo apt update
sudo apt install build-essential cmake ninja-build python3 pandoc llvm-dev \
zlib1g-dev libzstd-dev libx11-dev libsqlite3-dev libpq-devlibsqlite3-dev and libpq-dev enable the optional SQLite and PostgreSQL
providers; they are not required for the core language. The October 2026
development workstation uses Ubuntu 26.04,
GCC 15.2 and LLVM 21.1.8. This development setup is separate from the published
release profile, which targets Ubuntu 24.04 and LLVM 18.
From the repository root, run:
./scripts/build-sdk.shBy default the helper configures in build/cmake, runs CTest, and publishes a
validated SDK at sdk. The command executables are directly at that SDK
root. The same directory contains nillib with strictly compiled binary NIL
modules, nilstd with the matching Ny and Matrix sources, compiled HTML in docs, and a
hash-bearing manifest.json.
The complete command set is nilcompiler, nilinterpreter, nilassembler,
nillinker, nillsp, nildebugger, nilschema, nilagent, nilbuild, niltest, and aperture (with the host
platform's executable suffix where needed). The helper validates this layout
and only replaces the active SDK after the entire standard library and smoke
path pass.
SDK publication keeps immutable generations behind the active directory symlink.
On macOS, replacement also retains old symlink inodes in a private sibling
folder named .<sdk-name>.retained-links (for example, .sdk.retained-links).
This prevents APFS from invalidating readers already resolving through a replaced
link. These records are not SDK entry points: their relative targets need not
resolve from the retention folder. They are not automatically pruned. Remove
retained links only when publication and every SDK reader have stopped. An
unsupported retention primitive fails before changing the active SDK. Darwin
publication creates its new symlink with mode 0777 even under a restrictive
caller umask, restoring that umask before activation; it does not change the
permissions of existing links or SDK directories.
The framework rebrand changes the checkout folder to exec-nil-framework,
with components such as nilcompiler, nilstd, ny, matrix, and vscode
directly beneath it; the former code/ and ext/ wrapper directories are removed.
The generated SDK is at <checkout>/sdk, while build files stay in build.
The rebrand also changes
commands from nycompiler/nyinterpreter/etc. to nilcompiler/nilinterpreter/etc.,
and SDK directories from nystd/nylib to nilstd/nillib. Linux native
libraries are nillib/native/libnil.so and nillib/native/libnil.a; AOT linking
uses the static companion. Rebuild an SDK as a whole instead of mixing old
and new tools. Existing .ny, .matrix, .mat, and ny.lang.* imports retain
their meanings. The VS Code extension keeps its installed identity and
ny.* configuration keys; update an explicit ny.sdkPath if it names the
old checkout folder. Documented build settings now use NIL_*; supported
legacy NY_* aliases are accepted when their new equivalents are absent.
A developer build and test run, without packaging the complete SDK, is below.
After moving machines or checkout paths, start with an empty build/cmake:
move any copied build directory aside first, because CMake caches absolute
source, compiler and dependency paths.
cmake -S . -B build/cmake -G Ninja \
-DCMAKE_BUILD_TYPE=Release \
-DCMAKE_EXPORT_COMPILE_COMMANDS=ON \
-DNIL_ENABLE_LLVM=ON \
-DLLVM_DIR="$(llvm-config --cmakedir)"
cmake --build build/cmake --parallel 6
ctest --test-dir build/cmake --parallel 4 --output-on-failureIf selecting a versioned LLVM installation, use its matching llvm-config-21
(or other version) in that command. Check the configure output for Found LLVM:
NIL_ENABLE_LLVM=ON alone does not guarantee that LLVM was discovered.
To package the configured build while working on uncommitted changes, run:
NIL_ALLOW_DIRTY_SOURCE=ON CMAKE_BUILD_PARALLEL_LEVEL=6 CTEST_PARALLEL_LEVEL=4 \
./scripts/build-sdk.shThe helper reuses build/cmake, including its selected LLVM installation,
reruns the tests and validates the SDK. This produces a development SDK marked
with its dirty-source status; it does not qualify or publish a release.
Omit NIL_ALLOW_DIRTY_SOURCE for a clean checkout. Adjust the parallel job counts
to suit available memory.
LLVM is optional. If CMake cannot find it, configure with
-DNIL_ENABLE_LLVM=OFF; with the helper, set NIL_ENABLE_LLVM=OFF. The core
compiler, NIL interpreter, debugger, language server, assembler, and linker are
always built. NIL_BUILD_EXPERIMENTAL_TOOLS=OFF omits only nilschema and
nilagent in a direct developer build. The SDK helper keeps the option enabled
because the complete SDK includes all eleven commands. Aperture is a separately versioned preview.
When tests are enabled, CMake requires Python rather than silently omitting the
route matrix and application contracts. Set NIL_RUN_TESTS=OFF with the helper,
or -DBUILD_TESTING=OFF with CMake, only for an intentional test-free build.
Windows x64 has native VM development coverage, including interpreter, bundles, JIT, compiler AOT, and standalone assembler/linker execution. It is not a qualified Windows v1/RC release target. The reviewed release profile remains Linux-only, and host-specific CTest skips remain visible in development evidence. The installed consumer suite requires every selected execution to pass; a skip, expected failure, or unavailable native backend is not accepted as a pass.
Use Windows 10 version 1903 or newer (the current validation VM runs Windows 11),
an x64 Visual Studio developer PowerShell environment with MSVC and the Windows
SDK, CMake, Ninja, Python, and Pandoc on PATH. Install LLVM development libraries
built for the MSVC ABI, not just the compiler command-line tools. The current
Windows development configuration uses MSVC 14.44 and LLVM 18.1.8. SQLite tests
also require sqlite3.h at configure time and a compatible x64 sqlite3.dll
available to the Windows loader; SQLite is not included in the SDK. The
PostgreSQL provider also supports Windows numeric loopback/network addresses
with bounded connection deadlines. Its optional build requires libpq-fe.h
and a matching libpq runtime deployment; neither PostgreSQL nor GTK is bundled
in the SDK. See the database and
desktop UI provider contracts.
Known MSVC issue: the reference VM's optional vctip.exe telemetry uploader
remained unsignaled after termination was requested, so native linking correctly
failed its cleanup checks. The Visual Studio telemetry opt-out alone did not
prevent its launch. With explicit user approval, the reference VM's exact
toolchain uploader was reversibly disabled; the MSVC compiler and linker
binaries were not modified. This provisioning state is part of the development
validation, not proof that an unmodified MSVC installation passes. NIL does not
apply this change automatically, and toolchain repair or upgrades may restore
the uploader.
See the Windows recovery notebook
for the evidence, exact scope, and restoration record.
For example, adapting the dependency paths to your installation:
cmake -S . -B build/windows -G Ninja `
-DCMAKE_BUILD_TYPE=Release -DNIL_ENABLE_LLVM=ON `
-DNIL_BUILD_EXPERIMENTAL_TOOLS=ON -DBUILD_TESTING=ON `
-DCMAKE_INSTALL_BINDIR=. `
-DLLVM_DIR=C:/llvm/clang+llvm-18.1.8-x86_64-pc-windows-msvc/lib/cmake/llvm `
"-DNIL_LLVM_DIA_LIBRARY:FILEPATH=C:/Program Files (x86)/Microsoft Visual Studio/2022/BuildTools/DIA SDK/lib/amd64/diaguids.lib" `
-DNILCOMPILER_SQLITE_INCLUDE_DIR=C:/sqlite/include
& ./scripts/build-sdk.ps1 -BuildDirectory ./build/windows -Parallel 4Some Windows LLVM binary packages export an absolute diaguids.lib path from
the machine that built LLVM. If that file is missing, set
NIL_LLVM_DIA_LIBRARY:FILEPATH to the existing x64 DIA SDK library from your
selected Visual Studio installation, as above. NIL replaces only the single
missing literal DIA entry on LLVM's imported LLVMDebugInfoPDB target; it leaves
an existing valid entry and every unrelated link entry unchanged. The explicit
path stays in the CMake cache for subsequent regeneration. A missing, ambiguous,
or unsupported reference fails configuration with an actionable error. No LLVM
package files, global library search paths, or Visual Studio installation are
modified. Omit this option when your LLVM package already has a valid DIA path.
The PowerShell helper consumes this existing single-configuration build and
requires clean source by default. -AllowDirtySource is an explicit diagnostic
development option, not a release override. Each run creates a new
build/windows-candidates/development-<unique-id>/sdk (or a child of
-CandidateParent). It rebuilds, records fresh source/tool identities, runs the
complete CTest suite, installs tools and library sources, builds HTML docs,
strictly compiles the standard library, seals a development manifest, validates
the SDK, and runs installed source/binary-library consumers outside the checkout.
Logs and evidence stay beside sdk, outside its sealed payload. A failed
candidate is retained with FAILED.txt; it is not reported ready.
There is no SDK activation, replacement, release publication, or Lich upload in
this workflow. Successful candidates contain eleven .exe tools at their root,
nilstd sources, nillib binaries with native/nil.lib and native/nil.dll, and
compiled docs. Use the candidate explicitly through PATH or ny.sdkPath.
The programs also need the matching x64
Microsoft Visual C++ runtime
on the consumer host; the SDK does not redistribute it. Native compilation and
linking still require MSVC/Windows SDK development tools. A successful run on a
developer VM is not proof of installation on a bare Windows machine.
Native Intel and Apple Silicon builds are established with LLVM enabled and disabled. LLVM-enabled development SDKs pass the full installed standard-library campaign, isolated PostgreSQL routes, debugger/checkpoints and AppKit interpreter/native desktop/input checks. Original full CTest failures are retained alongside passing current-source follow-ups; these are development results, not qualified macOS SDK releases.
The manually dispatched macOS workflow contains the tested configure/build commands and records the runner, Apple SDK, LLVM and optional-provider inputs. It builds tools directly and retains the complete test inventory. The separate SDK workflow packages development SDKs and checks extraction, relocation and installed consumers. The installed replay workflow tests authenticated, unchanged SDK artifacts with current fixtures, including optional desktop/editor checks. This distinguishes passing source/build-tree tests from installed-package acceptance. Start with the platform support matrix and the macOS notebook for the exact source baselines and remaining work. Disabling LLVM does not make native routes available.
Create hello.ny:
fn main() -> i32
println("Hello from Ny")
return 0
end fnCompile to a separate NIL file, then run it in the interpreter:
sdk/nilcompiler --no-stdlib --no-bundle \
--output hello.nil hello.ny
sdk/nilinterpreter hello.nilThis uses --no-stdlib because println is a compiler/runtime intrinsic and
the broader library is still being repaired. It uses --no-bundle so the
compiler always leaves an inspectable .nil file instead of attempting to
combine it with an adjacent nilinterpreter executable.
For an application with imports, use a nil.project.nildata manifest and
nilbuild check, nilbuild build or nilbuild run. The
project guide includes the format and both execution
targets. The same project context is used by the VS Code extension.
When the SDK was configured with NIL_ENABLE_LLVM=ON and LLVM was found,
nilcompiler --native selects the LLVM backend. --jit requests its JIT mode.
This backend is experimental and more platform-sensitive than the NIL smoke
path. Native AOT linking uses the C++ compiler driver selected by CMake; set
-DNIL_NATIVE_LINKER_DRIVER=/path/to/driver at configure time to override it.
See the tool reference before using it.
ctest --test-dir build/cmake --output-on-failureThe registered tests cover loader validation, argument and exit-code behavior, textual and binary NIL, bundles, LLVM JIT/AOT when available, focused language regressions, negative inputs, and every configured production-application route: interpreter and bundle routes in all builds, plus native routes when LLVM is available. This is a growing executable baseline, not yet a complete language conformance suite. See tests/README.md.
The first-party Visual Studio Code extension is maintained under
vscode. It provides syntax highlighting, snippets,
SDK discovery, a stdio client for nillsp, and commands and tasks for compiling,
running, native builds, SDK builds, and CTest. Build and development directions
are in the extension's README.
For other editors, nillsp is a stdio LSP server. Configure a generic LSP client
to start the absolute path to sdk/nillsp. Its semantic features are
still limited and experimental.