code wiki / (root) / _offc_nxc_small.nx

_offc_nxc_small.nx

buildroot/runtime/_offc_nxc_small.nx

7039 B169 linesdepth 7pulls 27 transitivereach 0 importersview sourcekind tooltopic offc
docsdependenciesstructsconstsfunctions

about

nxc.nx -- the full NishiLang sovereign-compiler driver. Chains every piece of our stack in pure NishiLang: source (.nx) -> import-expand -> lex -> parse -> opt -> regalloc -> riscv -> nxasm (assemble) -> elf_writer (wrap) -> sys_write(stdout) Output is a self-contained RV64 Linux ELF executable. Zero third- party code on the program path: no gcc, no binutils `as`, no ld, no libc, no external crt0. The only external thing is the Linux kernel ABI, which NishiOS replaces 1:1. CLI: `nxc <path>.nx` reads the file, runs the import expander to inline `import \"...\"` directives into a single source blob, then drives the compile pipeline and writes the ELF to stdout. Pipe to a file + chmod +x to run: nxc hello.nx > hello && chmod +x hello && ./hello With no args it compiles a baked-in demo source so `./nxc` still exits successfully for smoke-testing the chain. Status (2026-04-22): parse.nx has full monomorphization for generic struct + enum; the earlier \"syntax accepted but no substitution\" gap is closed. Outstanding work to fully retire gcc from the compiler bootstrap is QEMU/real-RV64 verification of the produced ELF (Phase 5 roadmap).

dependencies 14 imports · 0 importers

syscalls.nx types.nx lex_kinds.nx outbuf.nx ir.nx lex.nx parse.nx opt.nx regalloc.nx riscv.nx _offc_nxc_small.nx

diagram shows first 10 each side; +4 more imports, +0 more importers in the complete lists below.

imports: syscalls.nxtypes.nxlex_kinds.nxoutbuf.nxir.nxlex.nxparse.nxopt.nxregalloc.nxriscv.nxcrt0.nximport.nxnxasm_v2.nxelf_writer.nx

imported by: nobody (leaf or entry point)

call flow from main pre-order; caps 40 nodes / depth 6 declared; ↻ = already shown

main nxc_compile lex_source skip_ws_comments peek advance peek2 peek ↻ is_alpha lex_ident_or_kw tok_text_ptr peek ↻ is_alnum is_alpha ↻ is_digit advance ↻ keyword_lookup push_tok is_digit ↻ lex_number peek ↻ peek2 ↻ advance ↻ is_hexdigit is_digit ↻ hex_val push_tok ↻ is_digit ↻ lex_string advance ↻ tok_text_ptr ↻ peek ↻ push_tok ↻ peek2 ↻ emit_punct advance ↻ push_tok ↻ advance ↻ push_tok ↻ parse_module

structs

none

consts

142const EXPAND_OUT_CAP: i64 = 4194304

functions

58func nxc_compile(src: *u8, fd: i64) -> i64 {
144func main(argc: i64, argv: *i64) -> i64 {