code wiki / _hdl_build / nx_nishilang_norm.nx

nx_nishilang_norm.nx

buildroot/runtime/_hdl_build/nx_nishilang_norm.nx

4280 B97 linesdepth 3pulls 3 transitivereach 0 importersview sourcekind tool
docsdependenciesstructsconstsfunctions

about

nx_nishilang_norm.nx -- THE GENERAL-MODEL BRIDGE (autonomous-builder lane, 2026-07-20). The maker-climb root cause (NB7): a strong GENERAL coder (Qwen-class, coder15) emits `else if` / `else` blocks that NishiLang has no keyword for -> build breaks. This normalizer rewrites those into valid NishiLang EARLY-RETURN form so any off-the-shelf coder's output compiles. SOUND by construction of the loop: the transform is only a SYNTAX rewrite; the symbolic judge (nx_symjudge) then property-verifies the normalized fix over an exhaustive sweep, so a mis-normalization is caught (fail-closed) -- never a silent wrong fix. Rewrites (semantics-preserving for return-bodies): `} else if C {` -> `} if C {` (else-if chain -> separate early-return ifs) `} else { E }` -> `} E ` (strip the else wrapper + its matching close brace) argv: <infile> <outfile> (reads generated-fix text, writes normalized NishiLang) exit: 0 wrote | 2 io. Idempotent (already-valid NishiLang passes through byte-unchanged). license_tier: ORIGINAL No hw writes (Rule 26).

dependencies 2 imports · 0 importers

nx_seg_store.nx nx_syscalls.nx nx_nishilang_norm.nx

imports: nx_seg_store.nxnx_syscalls.nx

imported by: nobody (leaf or entry point)

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

main sys_write sys_exit sys_mmap sys_read_file sys_openat_rd sys_lseek sys_mmap ↻ sys_read sys_close nn_normalize sys_mmap ↻ nn_starts ss_writefile sys_openat_wr sys_write ↻ sys_close ↻ sys_fsync

structs

none

consts

16const NN_CAP: i64 = 262144
17const NN_MAXPEND: i64 = 64
18const NN_LB: i64 = 123 //
19const NN_RB: i64 = 125 // }

functions

21func nn_starts(b: *u8, i: i64, n: i64, s: *u8) -> i64
called by 1: nn_normalize
32func nn_normalize(src: *u8, n: i64, out: *u8) -> i64
called by 1: main calls 2: sys_mmapnn_starts
80func main(argc: i64, argv: *i64) -> i64