code wiki / _hdl_build / nx_lang_export_seed.nx
nx_lang_export_seed.nx
buildroot/runtime/_hdl_build/nx_lang_export_seed.nx
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
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
structs
| none |
consts
| 12 | const K_MAGIC_4096: i64 = 4096 |
functions
| 15 | func catn(dst: *u8, off: i64, v: i64) -> i64 |
| 29 | func cat(dst: *u8, off: i64, s: *u8) -> i64 called by 1: main |
| 37 | func catc(dst: *u8, off: i64, c: i64) -> i64 { dst[off] = (c as u8); return off + 1 } called by 1: main |
| 39 | func puts(s: *u8) -> i64 { var n: i64 = 0; while s[n] != (0 as u8) { n = n + 1 } sys_write(1, s, n); return 0 } |
| 40 | func putn(v: i64) -> i64 { let b: *u8 = sys_mmap(28); let o: i64 = catn(b, 0, v); sys_write(1, b, o); return 0 } |
| 42 | func wfile(path: *u8, buf: *u8, n: i64) -> i64 |
| 51 | func native(n: i64) -> i64 called by 1: main |
| 58 | func main() -> i64 |