code wiki / _hdl_build / nx_gramdec_gate.nx
nx_gramdec_gate.nx
buildroot/runtime/_hdl_build/nx_gramdec_gate.nx
about
nx_gramdec_gate.nx -- NB10 gate: grammar-constrained decode (nx_gramdec_lib) teeth.
T1-T8 = automaton ruler teeth (no model). T9 = LIVE no-op equivalence: on an already-grammatical
greedy generation the constrained decode must be BIT-EXACT (prefix) with nsv_generate, zero
rejections, accept-stop. T10 = LIVE mask-fires (anti-vacuity + escape): an else-if-baited prompt
must (a) make the UNCONSTRAINED model emit `else if` (proves the bait bites -- the vacuity guard),
(b) under the mask produce grammar-VALID output with >=1 rejection and NO `else if`.
MUTATION PROOF (rung 5): flip GD_NEG_ALLOW_ELSEIF=1 in nx_gramdec_lib.nx, rebuild, run -> T3
accepts the else-if text and T10 sees the escape -> verdict=RED exit 1. Restore -> GREEN.
argv: [model.gguf] [probe] (default model /home/elderwesto/nx_stage/nx_15b_model.gguf;
"probe" prints raw outputs for tooth calibration instead of judging).
license_tier: ORIGINAL No hw writes (Rule 26).
dependencies 1 imports · 0 importers
imports: nx_gramdec_lib.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
| 14 | const GG_MAXNEW: i64 = 120 |
| 15 | const GG_OCAP: i64 = 4000 |
functions
| 17 | func gg_w(s: *u8) -> i64 { var n: i64 = 0; while s[n] != (0 as u8) { n = n + 1 } sys_write(1, s, n); return 0 } |
| 18 | func gg_wn(v: i64) -> i64 |
| 31 | func gg_slen(s: *u8) -> i64 { var n: i64 = 0; while s[n] != (0 as u8) { n = n + 1 } return n } |
| 32 | func gg_cat(b: *u8, off: i64, s: *u8) -> i64 |
| 38 | func gg_find(hay: *u8, hn: i64, needle: *u8, from: i64) -> i64 |
| 55 | func gg_tooth(name: *u8, got: i64) -> i64 |
| 65 | func gg_val(s: *u8) -> i64 { let n: i64 = gg_slen(s); return gd_validate(s, n) } |
| 68 | func gg_prompt_clean(pb: *u8) -> i64 |
| 80 | func gg_prompt_bait(pb: *u8) -> i64 |
| 95 | func gg_gen(which: i64, tx: *u8, mt: *i64) -> i64 |
| 114 | func main(argc: i64, argv: *i64) -> i64 |