Tooling & Debugging

Nyx treats tooling and debugging as first-class features, not afterthoughts. The compiler itself doubles as a language server, the runtime includes a time-travel debugger, and the standard library provides a built-in test framework and benchmarking.

Development Tooling

Language Server Protocol (LSP) — nyx-ls

The Nyx LSP server reuses the compiler's incremental analysis engine, guaranteeing 100% consistency between editor diagnostics and actual compilation errors.

Code Formatter — nyx fmt

Uses the lossless Concrete Syntax Tree (CST) to format code. Preserves intentional blank lines and custom line breaks while normalising indentation and spacing. Output is always idempotent.

Documentation Generator — nyx doc

Parses doc comments (///) and generates static HTML documentation with cross-referenced types, search, and syntax-highlighted examples.

Build System & Package Manager — nyx

CommandPurpose
nyx initScaffold a new project
nyx add <pkg>Resolve, fetch, and lock a dependency
nyx buildIncremental compilation with file-hashing and caching
nyx runBuild and execute in one step
nyx testDiscover and run all @test functions
nyx publishPackage and upload to the registry
nyx installRestore dependencies from lockfile

The build system supports reproducible, byte-for-byte deterministic builds and cryptographic signing of artifacts.

Profiling

Debugging

Time-Travel Debugger

When a Nyx program is run with nyx run --record, the runtime logs all non-deterministic events: I/O results, random numbers, task scheduling decisions, and thread interleavings. The recorded trace is fully deterministic.

nyx debug <trace> launches an interactive debugger (CLI or GUI) that can step forward and backward through execution.

Because Nyx's region allocation is deterministic and borrow-checked, the trace only records external inputs—not every memory operation—so overhead is manageable.

Hot-Reload (Development Mode)

For rapid iteration in UI code, changed modules compile to a shared library and patch into the running process. The widget tree automatically re-executes its build methods while preserving local state (text inputs, scroll positions, animation controllers). On the web, the WASM module is hot-swapped via the JS bridge.

Structured Logging & Tracing

std.log provides tamper-evident, capability-aware logging. Logs can be enriched with cryptographic chain of custody for audit. The async runtime integrates with std.log so every spawned task carries a trace ID for correlating logs across concurrent operations.

Testing Framework

Unified Architecture

All these tools work together. The LSP server uses the same incremental compilation database that drives nyx build, and the debugger replays traces that the profiler can also analyse. You never leave the Nyx ecosystem to develop, test, debug, and deploy your application.