code wiki / _hdl_build / nx_lang_export_seed.nx

nx_lang_export_seed.nx

buildroot/runtime/_hdl_build/nx_lang_export_seed.nx

3974 B87 linesdepth 2pulls 2 transitivereach 0 importersview sourcekind tooltopic lang
docsdependenciesstructsconstsfunctions

about

nx_lang_export_seed.nx -- LANGUAGE-EXPORT HAL, seed rung (LANG-EXPORT-001). Operator: "we need to be able to get different languages as output capabilities that can work on desktop and mobile ... so it can live in C or other languages when we sell it." PATTERN (sanctioned first-time bootstrap, like nx_wasm_emit_seed for wat): one NEUTRAL computation spec -> emitted as SOURCE in N target languages. Proven here for C + JS from the SAME spec; the GROW rung makes the per-language templates DATA (emitter-of-emitters) so Swift(iOS)/Kotlin(Android)/Dart = new backend rows, and a language-export census measures (language x platform) reach. SPEC (neutral): sum of squares 1..N. The organ ALSO computes it natively; the GATE = gcc(le_seed.c) and node(le_seed.js), the BUYER's reference runtimes, must both print the native value byte-identical (unforgeable: an independent compiler/runtime re-runs the emitted source). license_tier: ORIGINAL

dependencies 1 imports · 0 importers

nx_syscalls.nx nx_lang_export_seed.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 native sys_mmap cat catn sys_mmap ↻ catc wfile sys_openat_wr sys_write sys_close puts sys_write ↻ putn sys_mmap ↻ catn ↻ sys_write ↻

structs

none

consts

12const K_MAGIC_4096: i64 = 4096

functions

15func catn(dst: *u8, off: i64, v: i64) -> i64
called by 2: putnmain calls 1: sys_mmap
29func cat(dst: *u8, off: i64, s: *u8) -> i64
called by 1: main
37func catc(dst: *u8, off: i64, c: i64) -> i64 { dst[off] = (c as u8); return off + 1 }
called by 1: main
39func puts(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
40func putn(v: i64) -> i64 { let b: *u8 = sys_mmap(28); let o: i64 = catn(b, 0, v); sys_write(1, b, o); return 0 }
called by 1: main calls 3: sys_mmapcatnsys_write
42func wfile(path: *u8, buf: *u8, n: i64) -> i64
51func native(n: i64) -> i64
called by 1: main
58func main() -> i64