code wiki / _hdl_build / nx_eoe_prog.nx

nx_eoe_prog.nx

buildroot/runtime/_hdl_build/nx_eoe_prog.nx

8846 B148 linesdepth 2pulls 2 transitivereach 0 importersview sourcekind tooltopic eoe
docsdependenciesstructsconstsfunctions

about

nx_eoe_prog.nx -- EMITTER-OF-EMITTERS, GENERALITY RUNG 5 (THE INFLECTION): a UNIFIED STATEMENT-LIST MINI-LANGUAGE, not a 4th single-shape emitter. Rungs 006g/h/i each emitted ONE fixed shape (a linear op-list / a 2-way branch / a single-body while). This rung unifies them into a recursive GRAMMAR whose spec is a LIST OF STATEMENTS, where a branch's or loop's body is ITSELF a statement list (NESTING). That recursion is the qualitative jump: the team now specs an organ in a real (if tiny) language -- sequence + conditional + iteration, arbitrarily composed -- which is the shape of general control flow. A recursive descent over the spec PRETTY-PRINTS the corresponding nested NishiLang; nx_cc compiles it (codegen delegated to the compiler the team owns). nx_eoe_prog <basename> <start> <stmt...> stmt grammar (tokens): a<n> | m<n> | s<n> acc = acc + / * / - n if <pred> [ <stmt...> ] one-armed conditional (pred = g<t>|l<t>|e<t>) while <pred> [ <stmt...> ] predicate-driven loop (per-loop runaway guard) `[` and `]` are their own tokens; blocks NEST. Emits main() that runs the program over acc=<start> and prints "RESULT=<acc>\n". no-false-green plan (X-AUT-006d): nested specs that DIVERGE -- e.g. flipping an inner threshold so the conditional inside a loop fires a different number of times -> a DIFFERENT correct result; tamper any op/threshold -> result changes. Sovereign, no gcc/.sh. HONEST SCOPE: single i64 accumulator, one-armed if, integer ops; NOT yet multiple funcs/typed params/imports -- but the CONTROL-FLOW grammar is now compositional, the real inflection toward general organ synthesis. license_tier: ORIGINAL

dependencies 1 imports · 0 importers

nx_syscalls.nx nx_eoe_prog.nx

imports: nx_syscalls.nx

imported by: nobody (leaf or entry point)

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

main eop_p sys_write eop_atoi_from sys_mmap eop_cat eop_catn eop_catn ↻ sys_mmap ↻ eop_emit_stmts eop_indent eop_cat ↻ eop_cat ↻ eop_catn ↻ eop_atoi_from ↻ eop_cmp eop_cat ↻ eop_catn ↻ eop_atoi_from ↻ sys_mmap ↻ eop_emit_stmts ↻ sys_openat_wr sys_write ↻ sys_close

structs

none

consts

29const K_MAGIC_262144: i64 = 262144

functions

31func eop_cat(dst: *u8, off: i64, s: *u8) -> i64 { var i: i64 = 0; while s[i] != (0 as u8) { dst[off+i] = s[i]; i = i + 1 } return off + i }
32func eop_catn(dst: *u8, off: i64, v: i64) -> i64
44func eop_p(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 1: main calls 1: sys_write
45func eop_atoi_from(s: *u8, from: i64) -> i64
50func eop_indent(buf: *u8, off: i64, depth: i64) -> i64
called by 1: eop_emit_stmts calls 1: eop_cat
56func eop_cmp(buf: *u8, off: i64, pred: *u8) -> i64
70func eop_emit_stmts(buf: *u8, off: i64, argv: *i64, argc: i64, ti: i64, depth: i64, out_ti: *i64, gid: *i64) -> i64
107func main(argc: i64, argv: *i64) -> i64