src/: C compiler front/mid/back-end (AST, CFG/SSA/LIR, lowering, semantic analysis).runtime/: GC, allocator, coroutine, and libc shims; built first intolib/<platform>/libruntime.a.std/: Standard library.nmodules; mirrors namespaces likefmt,io,net,time.nls/: Rust language server; builds tonls/target/{debug,release}/nls.tests/: C harness intests/features/*.cplus cases intests/features/cases/with.testaroutputs.include/andutils/: Shared headers and helpers reused by compiler/runtime.build*/,release/,lib/: Generated artifacts; keep them out of commits unless intentional.
- Build runtime (needed before tests):
cmake -B build-runtime -S runtime -DCMAKE_BUILD_TYPE=Release && cmake --build build-runtime --target runtime. - Configure + build compiler/tooling:
cmake -B build -S . && cmake --build build -- -j8(outputsbuild/nature,build/npkg,build/nls). - Fast rebuild:
cmake --build build -- -j8. - Full tests:
cd build && ctest. - Focused tests:
cd build && ctest -R 20260103_00_selective_imports -Vor patterns likectest -R import. - NLS only:
cd nls && cargo build --release(runcargo fmtfirst).
- C/C++: Use
.clang-format(LLVM base, 4-space indent, no tabs); runclang-format -i file.c. - Rust:
cargo fmt; Go (npkg/scripts):gofmt -w. - Tests follow
YYYYMMDD_NN_description.cwith matchingtests/features/cases/<name>/and.testaroutput. - Source files and identifiers favor
snake_case; keep braces/spaces as formatter defines.
- Build runtime + main tree before
ctest; link errors like_global_safepointusually mean rerun the runtime build. - New tests: harness in
tests/features/plus cases intests/features/cases/<name>/; reruncmake ..inbuild/, thenctest -R <name>. - Manual spot checks:
cd tests/features/cases/<dir> && ../../build/nature build main.n && ./main. - CI (
.github/workflows/test.yml) builds on Linux/macOS and runsctest; keep additions deterministic and low-output.
- Use conventional commits (
feat:,fix:,chore:) with concise scopes. - Before pushing, run
cmake --build build -- -j8andcd build && ctest; call out any skipped tests. - PRs: summarize the change, note impacted areas (compiler/runtime/std/nls/tests), link issues, and list verification commands; mention new assets or downloads.
- Exclude generated
build*/, caches, and large binaries; document required external artifacts in README-style notes.