nx_dangling_else_gate.nx
buildroot/runtime/nx_dangling_else_gate.nx
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
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
structs
| none |
consts
| 17 | const DE_DIR: *u8 = "/tmp/nx_dangling_else_gate\x00" as *u8 |
| 18 | const DE_BAD: *u8 = "/tmp/nx_dangling_else_gate/fx_dangling.nx\x00" as *u8 |
| 19 | const DE_CHAIN: *u8 = "/tmp/nx_dangling_else_gate/fx_chain.nx\x00" as *u8 |
| 20 | const DE_PLAIN: *u8 = "/tmp/nx_dangling_else_gate/fx_plain.nx\x00" as *u8 |
| 21 | const DE_LOUD: *u8 = "/tmp/nx_dangling_else_gate/fx_loud.nx\x00" as *u8 |
| 22 | const DE_ERR_L: *u8 = "/tmp/nx_dangling_else_gate/fx_loud.err\x00" as *u8 |
| 23 | const DE_MODVAR: *u8 = "/tmp/nx_dangling_else_gate/fx_modvar.nx\x00" as *u8 |
| 24 | const DE_MODOK: *u8 = "/tmp/nx_dangling_else_gate/fx_modok.nx\x00" as *u8 |
| 25 | const DE_ERR_V: *u8 = "/tmp/nx_dangling_else_gate/fx_modvar.err\x00" as *u8 |
| 26 | const DE_ERR_O: *u8 = "/tmp/nx_dangling_else_gate/fx_modok.err\x00" as *u8 |
| 27 | const DE_BLOCK: *u8 = "/tmp/nx_dangling_else_gate/fx_block.nx\x00" as *u8 |
| 28 | const DE_SCOPE: *u8 = "/tmp/nx_dangling_else_gate/fx_scope.nx\x00" as *u8 |
| 29 | const DE_ERR_K: *u8 = "/tmp/nx_dangling_else_gate/fx_block.err\x00" as *u8 |
| 30 | const DE_ERR_S: *u8 = "/tmp/nx_dangling_else_gate/fx_scope.err\x00" as *u8 |
| 31 | const DE_ERR_B: *u8 = "/tmp/nx_dangling_else_gate/fx_dangling.err\x00" as *u8 |
| 32 | const DE_ERR_C: *u8 = "/tmp/nx_dangling_else_gate/fx_chain.err\x00" as *u8 |
| 33 | const DE_ERR_P: *u8 = "/tmp/nx_dangling_else_gate/fx_plain.err\x00" as *u8 |
| 34 | const DE_DEVNULL: *u8 = "/dev/null\x00" as *u8 |
| 35 | const DE_CC_NAS: *u8 = "buildroot/_offc/nx_cc_sovereign.elf\x00" as *u8 // NAS gate CWD = nishihost root |
| 36 | const DE_CC_LAP: *u8 = "_offc/nx_cc_sovereign.elf\x00" as *u8 // laptop CWD = nxc2 root |
| 37 | const DE_CAP: i64 = 65536 |
| 38 | const DE_MODE: i64 = 420 |
functions
| 40 | func de_slen(s: *u8) -> i64 { var n: i64 = 0; while s[n] != (0 as u8) { n = n + 1 } return n } |
| 41 | func de_w(s: *u8) -> i64 { sys_write(1, s, de_slen(s)); return 0 } |
| 42 | func de_find(b: *u8, n: i64, pat: *u8) -> i64 |
| 54 | func de_write_file(path: *u8, body: *u8) -> i64 |
| 63 | func de_compile(cc: *u8, src: *u8, errpath: *u8) -> i64 |
| 81 | func de_read(path: *u8, buf: *u8, cap: i64) -> i64 |
| 92 | func de_pick_cc() -> *u8 |
| 98 | func main() -> i64 |