code wiki / (root) / nx_dangling_else_gate.nx

nx_dangling_else_gate.nx

buildroot/runtime/nx_dangling_else_gate.nx

13338 B173 linesdepth 3pulls 3 transitivereach 0 importersview sourcekind gate/proof
docsdependenciesstructsconstsfunctions

about

nx_dangling_else_gate.nx -- LN30 (lang.plan): AN `else` WITH NO `if` IS REFUSED, NEVER RUN. End-to-end over the PROMOTED compiler: three fixtures are assembled at runtime in /tmp/<gate>/ (never a file a source census could mistake for an organ), the compiler is forked on each with stderr captured, and the teeth read the captured bytes. fx_dangling `if c {..} else {..} else {..}` -> MUST be refused, naming the else, with where (caret), why and fix fx_chain `if {..} else if {..} else {..}` -> MUST compile (the else-if production is untouched) fx_plain `if {..} else {..}` then a second `if` -> MUST compile (an ordinary else is untouched) Why this exists (measured 2026-09-02, nx_autofix_intake_gate): a `} else { ... }` hanging after an if/else that had already closed reached the statement fallback, produced nothing, and the block after it parsed as a bare block that RAN UNCONDITIONALLY -- every admission-refused row was counted twice while the gate printed a partition that did not sum. The refusal is the LN30 contract; the two controls keep this gate from passing on a compiler that refuses every else. Byte-identity of default builds is nx_cc_equiv_gate's job, deliberately not duplicated here. nx_dangling_else_gate -- verdict in the exit code (gv_verdict) license_tier: ORIGINAL layer: lang module: nishi-core.lang.dangling_else_gate

dependencies 2 imports · 0 importers

nx_syscalls.nx nx_gate_verdict.nx nx_dangling_else_gate.nx

imports: nx_syscalls.nxnx_gate_verdict.nx

imported by: nobody (leaf or entry point)

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

main gv_ctr sys_mmap nxa_die sys_write sys_exit nxa_lock_take nxa_lock_addr sys_write ↻ nxa_lock_give nxa_lock_addr ↻ nxa_report_overrun sys_write ↻ nxa_dump_printable sys_write ↻ nxa_dump_sizes sys_write ↻ sys_mkdir de_pick_cc sys_openat_rd sys_close de_w sys_write ↻ de_slen de_write_file sys_openat_wr de_slen ↻ sys_write ↻ sys_close ↻ gv_check gv_puts sys_write ↻ de_compile sys_fork sys_openat_wr ↻ sys_dup3 sys_mmap ↻ sys_execve sys_exit ↻ sys_wait4

structs

none

consts

17const DE_DIR: *u8 = "/tmp/nx_dangling_else_gate\x00" as *u8
18const DE_BAD: *u8 = "/tmp/nx_dangling_else_gate/fx_dangling.nx\x00" as *u8
19const DE_CHAIN: *u8 = "/tmp/nx_dangling_else_gate/fx_chain.nx\x00" as *u8
20const DE_PLAIN: *u8 = "/tmp/nx_dangling_else_gate/fx_plain.nx\x00" as *u8
21const DE_LOUD: *u8 = "/tmp/nx_dangling_else_gate/fx_loud.nx\x00" as *u8
22const DE_ERR_L: *u8 = "/tmp/nx_dangling_else_gate/fx_loud.err\x00" as *u8
23const DE_MODVAR: *u8 = "/tmp/nx_dangling_else_gate/fx_modvar.nx\x00" as *u8
24const DE_MODOK: *u8 = "/tmp/nx_dangling_else_gate/fx_modok.nx\x00" as *u8
25const DE_ERR_V: *u8 = "/tmp/nx_dangling_else_gate/fx_modvar.err\x00" as *u8
26const DE_ERR_O: *u8 = "/tmp/nx_dangling_else_gate/fx_modok.err\x00" as *u8
27const DE_BLOCK: *u8 = "/tmp/nx_dangling_else_gate/fx_block.nx\x00" as *u8
28const DE_SCOPE: *u8 = "/tmp/nx_dangling_else_gate/fx_scope.nx\x00" as *u8
29const DE_ERR_K: *u8 = "/tmp/nx_dangling_else_gate/fx_block.err\x00" as *u8
30const DE_ERR_S: *u8 = "/tmp/nx_dangling_else_gate/fx_scope.err\x00" as *u8
31const DE_ERR_B: *u8 = "/tmp/nx_dangling_else_gate/fx_dangling.err\x00" as *u8
32const DE_ERR_C: *u8 = "/tmp/nx_dangling_else_gate/fx_chain.err\x00" as *u8
33const DE_ERR_P: *u8 = "/tmp/nx_dangling_else_gate/fx_plain.err\x00" as *u8
34const DE_DEVNULL: *u8 = "/dev/null\x00" as *u8
35const DE_CC_NAS: *u8 = "buildroot/_offc/nx_cc_sovereign.elf\x00" as *u8 // NAS gate CWD = nishihost root
36const DE_CC_LAP: *u8 = "_offc/nx_cc_sovereign.elf\x00" as *u8 // laptop CWD = nxc2 root
37const DE_CAP: i64 = 65536
38const DE_MODE: i64 = 420

functions

40func de_slen(s: *u8) -> i64 { var n: i64 = 0; while s[n] != (0 as u8) { n = n + 1 } return n }
41func de_w(s: *u8) -> i64 { sys_write(1, s, de_slen(s)); return 0 }
called by 1: main calls 2: sys_writede_slen
42func de_find(b: *u8, n: i64, pat: *u8) -> i64
called by 1: main calls 1: de_slen
54func de_write_file(path: *u8, body: *u8) -> i64
63func de_compile(cc: *u8, src: *u8, errpath: *u8) -> i64
81func de_read(path: *u8, buf: *u8, cap: i64) -> i64
called by 1: main calls 3: sys_openat_rdsys_readsys_close
92func de_pick_cc() -> *u8
called by 1: main calls 2: sys_openat_rdsys_close
98func main() -> i64