code wiki / _hdl_build / nx_machine_gen.nx
nx_machine_gen.nx
buildroot/runtime/_hdl_build/nx_machine_gen.nx
about
nx_machine_gen.nx -- MACHINE GENERATOR (toward the team authoring its own substrate):
from a compact DATA spec (op-fragments + (a,b,y) examples) it EMITS a complete, working
evo-deriver to runtime/_hdl_build/nx_gen_machine.nx. The emitted machine, when built+run,
SEARCHES op-sequences to fit the examples and self-verifies on held-out -- i.e. a NEW
machine is authored from DATA, not hand-written. Claude authors THIS generator (the meta-
substrate, like the compiler/genesis seed); machines become data-authored = the real
reduction of Claude from the substrate. Demo spec derives f(a,b)=a*b+a. license_tier: ORIGINAL
dependencies 2 imports · 0 importers
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
structs
| none |
consts
| 10 | const K_MAGIC_32768: i64 = 32768 |
| 12 | const NOPS: i64 = 6 |
| 13 | const NEX: i64 = 10 |
functions
| 16 | func mg_op(k: i64) -> *u8 called by 1: main |
| 24 | func mg_xa(i: i64) -> i64 { if i==0 {return 2} if i==1 {return 4} if i==2 {return 3} if i==3 {return 5} if i==4 {return 6} if i==5 {return 1} if i==6 {return 7} if i==7 {return 3} if i==8 {return 8} return 4 } called by 1: mg_table |
| 25 | func mg_xb(i: i64) -> i64 { if i==0 {return 3} if i==1 {return 5} if i==2 {return 2} if i==3 {return 1} if i==4 {return 2} if i==5 {return 7} if i==6 {return 2} if i==7 {return 3} if i==8 {return 1} return 4 } called by 1: mg_table |
| 26 | func mg_xy(i: i64) -> i64 { if i==0 {return 8} if i==1 {return 24} if i==2 {return 9} if i==3 {return 10} if i==4 {return 18} if i==5 {return 8} if i==6 {return 21} if i==7 {return 12} if i==8 {return 16} return 20 } called by 1: mg_table |
| 28 | func mg_w(buf: *u8, off: i64, s: *u8) -> i64 { var i: i64 = 0; while s[i] != (0 as u8) { buf[off+i] = s[i]; i = i + 1 } return off + i } |
| 29 | func mg_wn(buf: *u8, off: i64, v: i64) -> i64 |
| 38 | func mg_pr(s: *u8) -> i64 { var n: i64 = 0; while s[n] != (0 as u8) { n = n + 1 } sys_write(1, s, n); return 0 } |
| 43 | func mg_prn(v: i64) -> i64 { nxi_out(v); return 0 } |
| 46 | func mg_table(buf: *u8, off: i64, name: *u8, which: i64) -> i64 |
| 63 | func main() -> i64 |