code wiki / (root) / nx_srcfmt_gate.nx

nx_srcfmt_gate.nx

buildroot/runtime/nx_srcfmt_gate.nx

8609 B160 linesdepth 4pulls 9 transitivereach 0 importersview sourcekind gate/proof
docsdependenciesstructsconstsfunctions

about

nx_srcfmt_gate.nx -- GATE for LN9, the canonical source formatter (lang.plan rung LN9, symbol srcfmt_emit). The done-rule: idempotent over the tokenizer stream, fmt(fmt(x)) == fmt(x); comments and string literals preserved; the formatted corpus builds byte-identical. This gate proves the deterministic half in-process (it IMPORTS nx_srcfmt, so nx_gate_bite mutating nx_srcfmt.nx and rebuilding the gate exercises the real subject) and the build-neutrality half on a hermetic fixture by forking the live compiler; the WHOLE-CORPUS build-neutrality is the lane's sweep (nx_srcfmt runs it over every .nx as a sibling in the tree so imports resolve; a /tmp copy fails expand_imports for a reason unrelated to the formatter -- measured 2026-08-23) and its count is published, not sampled here. The load-bearing non-vacuity tooth is T9: it proves the ORACLE inside the formatter actually distinguishes two different token streams -- the oracle is what makes "a formatter that changes a program is impossible" true, so a vacuous oracle would make every other tooth meaningless. Data captures in /tmp/nxsf/, the one runnable under _build/ (NAS /tmp is noexec). Usage: nx_srcfmt_gate [compiler_elf] (CWD = the tree root, like nx_cc_equiv_gate) license_tier: ORIGINAL No hw writes (Rule 26).

dependencies 4 imports · 0 importers

nx_syscalls.nx nx_gate_verdict.nx nx_srcfmt.nx nx_ccgate_lib.nx nx_srcfmt_gate.nx

imports: nx_syscalls.nxnx_gate_verdict.nxnx_srcfmt.nxnx_ccgate_lib.nx

imported by: nobody (leaf or entry point)

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

main ccg_anchor_root sys_openat_rd sys_close sys_chdir sys_mmap nxa_die sys_write sys_exit nxa_lock_take nxa_lock_addr sys_write ↻ nxa_lock_give nxa_lock_addr ↻ nxa_report_overrun sys_write ↻ nxa_dump_printable sys_write ↻ nxa_dump_sizes sys_write ↻ sys_mkdir ccg_pid gv_ctr sys_mmap ↻ gv_head gv_puts sys_write ↻ sys_mmap ↻ gv_check gv_puts ↻ g_has g_len g_fmt g_len ↻ sys_mmap ↻ srcfmt_emit_grow srcfmt_cap sf_at srcfmt_cap_ceiling sf_at ↻

structs

none

consts

none

functions

20func g_len(s: *u8) -> i64 { var n: i64 = 0; while s[n] != (0 as u8) { n = n + 1 } return n }
called by 3: g_fmtg_hasmain
23func g_fmt(src: *u8, op: *i64) -> i64
called by 1: main calls 3: g_lensys_mmapsrcfmt_emit_grow
31func g_has(a: *u8, m: i64, needle: *u8) -> i64
called by 1: main calls 1: g_len
45func g_write_file(path: *u8, buf: *u8, n: i64) -> i64
54func g_files_eq(a: *u8, b: *u8) -> i64
called by 1: main calls 2: sys_mmapsys_read_file
67func main(argc: i64, argv: *i64) -> i64