code wiki / _hdl_build / nx_infinibug.nx

nx_infinibug.nx

buildroot/runtime/_hdl_build/nx_infinibug.nx

11862 B265 linesdepth 3pulls 3 transitivereach 0 importersview sourcekind tool
docsdependenciesstructsconstsfunctions

about

nx_infinibug.nx -- INFINIGEN-FOR-CODE (worldclass/bugforge lane, 2026-07-24). Operator pointed at Infinigen (arXiv 2306.09310): a PROCEDURAL generator with NO static assets -- every scene is emitted from seeded random rules, and ground truth comes FREE from the generator. This is that idea ported from photorealistic worlds to VERIFIED CODE REPAIR: it procedurally emits a "world" of novel pure integer functions from a seeded grammar with difficulty knobs, so the bug-instance supply is INFINITE and CURRICULUM-CONTROLLABLE instead of the 35 hand-written functions the disk scan finds. COMPOSITION (rule 15 -- no duplicated machinery): infinibug ONLY generates the world (function source files); the PROVEN nx_bugforge miner then extracts ground-truth-labeled (buggy, oracle-fixed, F2P+P2P) instances from that dir exactly as it mines real code. Infinigen generates, bugforge harvests. This also proves bugforge is source-AGNOSTIC (real corpus OR procedural world, same loop). DETERMINISTIC: seeded LCG (reproducible curriculum -- seed is part of the input, like Infinigen's). SELF-CLEAN under nx_assure: iterative expression builder (NO recursion, P10-R1), no alloc in loops. verbs: gen <count> <seed> <difficulty 1-5> [outdir] (default outdir runtime/igworld) | selftest license_tier: ORIGINAL No hw writes (Rule 26).

dependencies 2 imports · 0 importers

nx_syscalls.nx nx_itoa_lib.nx nx_infinibug.nx

imports: nx_syscalls.nxnx_itoa_lib.nx

imported by: nobody (leaf or entry point)

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

main w sys_write ig_gen ig_one sys_mmap bcat bcatn sys_mmap ↻ ig_rand ig_next ig_fnbody ig_rand ↻ bcat ↻ ig_param ig_rand ↻ ig_cop ig_rand ↻ bcat ↻ ig_leaf ig_rand ↻ bcatn ↻ ig_expr ig_leaf ↻ ig_rand ↻ ig_aop ig_rand ↻ bcat ↻ bcat ↻ ig_write sys_openat_wr sys_write ↻ sys_close w ↻ wn nxi_out nxi_fd sys_mmap ↻ ccz_cat_num sys_write ↻

structs

none

consts

19const IG_MAGIC_12345: i64 = 12345
21const IG_A: i64 = 1103515245 // LCG multiplier (glibc rand; small, ratchet-safe as a named const)
22const IG_C: i64 = 12345 // LCG increment
23const IG_SRCCAP: i64 = 8192
24const IG_PATHCAP: i64 = 256
25const IG_ZERO: i64 = 48
26const IG_MODE: i64 = 420 // 0644
27const IG_MAXG: i64 = 3 // guard-clause ceiling
28const IG_MAXT: i64 = 7 // terms-per-expression ceiling

functions

32func w(s: *u8) -> i64 { var n: i64 = 0; while s[n] != (0 as u8) { n = n + 1 } sys_write(1, s, n); return 0 }
called by 3: ig_genig_selftestmain calls 1: sys_write
37func wn(v: i64) -> i64 { nxi_out(v); return 0 }
called by 2: ig_genig_selftest calls 1: nxi_out
38func bcat(b: *u8, off: i64, s: *u8) -> i64 { var i: i64 = 0; var o: i64 = off; while s[i] != (0 as u8) { b[o] = s[i]; o = o + 1; i = i + 1 } return o }
39func bcatn(b: *u8, off: i64, v: i64) -> i64
called by 2: ig_leafig_one calls 1: sys_mmap
53func ig_next() -> i64 { g_rng = g_rng * IG_A + IG_C; var v: i64 = g_rng; if v < 0 { v = 0 - v } return v }
called by 2: ig_randig_selftest
54func ig_rand(n: i64) -> i64 { if n <= 0 { return 0 } return ig_next() % n }
57func ig_param(b: *u8, o: i64, arity: i64) -> i64 { b[o] = (97 + ig_rand(arity)) as u8; return o + 1 }
called by 1: ig_fnbody calls 1: ig_rand
60func ig_leaf(b: *u8, o: i64, arity: i64) -> i64
called by 2: ig_exprig_fnbody calls 2: ig_randbcatn
66func ig_aop(b: *u8, o: i64) -> i64
called by 1: ig_expr calls 2: ig_randbcat
76func ig_cop(b: *u8, o: i64) -> i64
called by 1: ig_fnbody calls 2: ig_randbcat
83func ig_expr(b: *u8, o: i64, arity: i64, nterms: i64) -> i64
called by 1: ig_fnbody calls 4: ig_leafig_randig_aopbcat
104func ig_fnbody(src: *u8, o0: i64, arity: i64, diff: i64) -> i64
130func ig_write(path: *u8, buf: *u8, n: i64) -> i64
139func ig_one(outdir: *u8, seed: i64, idx: i64, diff: i64) -> i64
165func ig_gen(count: i64, seed: i64, diff: i64, outdir: *u8) -> i64
called by 1: main calls 3: ig_onewwn
187func ig_selftest() -> i64
244func main(argc: i64, argv: *i64) -> i64