code wiki / (root) / nx_langspec.nx

nx_langspec.nx

buildroot/runtime/nx_langspec.nx

33803 B767 linesdepth 4pulls 5 transitivereach 0 importersview sourcekind tool
docsdependenciesstructsconstsfunctions

about

nx_langspec.nx -- THE CONFORMANCE RUNNER for the written NishiLang specification. lang.plan rung LR5, watch symbol spec_conformance_run, board /compare/lang. THE FERROCENE LESSON, TAKEN EARLY. Rust reached safety-critical qualification only by retrofitting a written specification years after 1.0, and the qualification artifact was never the prose -- it was REQUIREMENTS-TO-TESTS TRACEABILITY. So the load-bearing half of this rung is this runner, not the document: every clause in knowledge/specs/nishilang.spec carries an ID, every case in knowledge/specs/nishilang.suite cites the clause IDs it exercises, and this organ resolves those citations MECHANICALLY, drives the SHIPPED compiler over every case, and reports which clauses no case exercises. That unexercised list is the real deliverable: a spec nothing checks is a comment, and a clause nothing exercises is UNVERIFIED however confidently it is written. WHAT IT IS NOT. It is not a second compiler-gate driver: it COMPOSES nx_ccgate_lib, the one organ in the estate that spawns the compiler, and nx_lineconf_lib for its thresholds. It does not replace nx_langdiag_gate -- that gate proved 11 hand-written rows refuse for the RIGHT reason and is where this suite's discipline comes from. What it adds is the three things a hard-coded row list structurally cannot have: the cases are DATA (adding one is a data row, not a rebuild), each case is TRACED to a normative clause, and the run reports COVERAGE over the whole clause set. THREE STATES, NEVER TWO. A case is PASS, FAIL or UNOBSERVABLE. UNOBSERVABLE is a case the runner could not judge through no fault of the language -- its source is missing, the assembler failed, the artifact could not be renamed. It is NOT folded into pass and NOT folded into fail: an axis that cannot see must abstain, never acquit. Every count is printed beside its denominator and the partition is reconciled in the output, because an abstention nobody reads is a lie nobody told. NO SILENT CAPS. Budgets come from the conf. A spec or suite that exceeds one is not truncated in silence: the surplus is counted, named OVER-BUDGET, and coverage_complete is forced to 0. EXITS: 0 CONFORMANT - 1 DEVIATION - 2 usage - 3 UNOBSERVABLE - 4 EMPTY-SUITE. EMPTY-SUITE is its own exit on purpose: a conformance runner that certifies the empty set is the vacuous-test defect wearing a certification costume, and 0 must be unreachable that way. DECLARED LIMITATION, MEASURED NOT ASSUMED: an INLINE case is materialised into a scratch directory outside the tree and the compiler resolves an import relative to the importing file, so an INLINE case CANNOT import. A case that needs the standard library is written as a fixture in the tree and cited by path. Found by this organ's own first run, which reported the offending case FAIL in the compiler's own words (expand_imports failed, exit 12) rather than passing it for the wrong reason. Usage: nx_langspec [run|coverage|clauses|cases] [spec] [suite] [compiler] [conf] The conf argument exists so a gate can supply its OWN thresholds against its OWN fixture spec

dependencies 4 imports · 0 importers

nx_syscalls.nx nx_gate_verdict.nx nx_ccgate_lib.nx nx_lineconf_lib.nx nx_langspec.nx

imports: nx_syscalls.nxnx_gate_verdict.nxnx_ccgate_lib.nxnx_lineconf_lib.nx

imported by: nobody (leaf or entry point)

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

main ccg_anchor_root sys_openat_rd sys_close sys_chdir 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_mmap ↻ lcf_str_of sys_mmap ↻ sys_read_file sys_openat_rd ↻ sys_lseek sys_mmap ↻ sys_read sys_munmap sys_close ↻ lcf_str lcf_find ls_p gv_puts sys_write ↻ sys_exit ↻ ls_streq spec_conformance_run lcf_int_of sys_mmap ↻

structs

none

consts

49const LS_CONF: *u8 = "knowledge/specs/nishilang_conformance.conf\x00"
50const LS_SPEC_DEF: *u8 = "knowledge/specs/nishilang.spec\x00"
51const LS_SUITE_DEF: *u8 = "knowledge/specs/nishilang.suite\x00"
52const LS_SCRATCH: *u8 = "/tmp/nx_langspec\x00"
54const LS_EXIT_CONFORMANT: i64 = 0
55const LS_EXIT_DEVIATION: i64 = 1
56const LS_EXIT_USAGE: i64 = 2
57const LS_EXIT_UNOBSERVABLE: i64 = 3
58const LS_EXIT_EMPTY: i64 = 4
60const LS_KIND_ACCEPT: i64 = 1
61const LS_KIND_REFUSE: i64 = 2
62const LS_KIND_RUN: i64 = 3
64const LS_V_PASS: i64 = 1
65const LS_V_FAIL: i64 = 2
66const LS_V_UNOBS: i64 = 3
68const LS_R_NONE: i64 = 0
69const LS_R_SRC_ABSENT: i64 = 1
70const LS_R_REFUSED_LEGAL: i64 = 2
71const LS_R_ASM_MARKER: i64 = 3
72const LS_R_ACCEPTED_ILLEGAL: i64 = 4
73const LS_R_WRONG_REASON: i64 = 5
74const LS_R_WRONG_CC_EXIT: i64 = 6
75const LS_R_ASSEMBLER: i64 = 7
76const LS_R_RENAME: i64 = 8
77const LS_R_WRONG_RUN_EXIT: i64 = 9
78const LS_R_INLINE_WRITE: i64 = 10
79const LS_R_BAD_KIND: i64 = 11
82const LS_LF: i64 = 9
83const LS_L_IDOFF: i64 = 0
84const LS_L_IDLEN: i64 = 1
85const LS_L_SECOFF: i64 = 2
86const LS_L_SECLEN: i64 = 3
87const LS_L_TTLOFF: i64 = 4
88const LS_L_TTLLEN: i64 = 5
89const LS_L_TXTOFF: i64 = 6
90const LS_L_TXTLEN: i64 = 7
91const LS_L_EX: i64 = 8
94const LS_CF: i64 = 18
95const LS_C_IDOFF: i64 = 0
96const LS_C_IDLEN: i64 = 1
97const LS_C_CLOFF: i64 = 2
98const LS_C_CLLEN: i64 = 3
99const LS_C_KIND: i64 = 4
100const LS_C_FLGOFF: i64 = 5
101const LS_C_FLGLEN: i64 = 6
102const LS_C_EXPOFF: i64 = 7
103const LS_C_EXPLEN: i64 = 8
104const LS_C_SRCOFF: i64 = 9
105const LS_C_SRCLEN: i64 = 10
106const LS_C_INLINE: i64 = 11
107const LS_C_VERD: i64 = 12
108const LS_C_WANT: i64 = 13
109const LS_C_GOT: i64 = 14
110const LS_C_PAROFF: i64 = 15
111const LS_C_PARLEN: i64 = 16
112const LS_C_REASON: i64 = 17
114const LS_PIPE: i64 = 124
115const LS_SEMI: i64 = 59
116const LS_SPEC_FIELDS: i64 = 5
117const LS_CASE_FIELDS: i64 = 8
118const LS_PERMIL: i64 = 1000
119const LS_MODE_RW: i64 = 0x1a4
120const LS_SCRATCH_MODE: i64 = 0x1ed
121const LS_FBUF: i64 = 32

functions

126func ls_p(s: *u8) -> i64 { gv_puts(s); return 0 }
127func ls_n(v: i64) -> i64 { gv_num(v); return 0 }
called by 2: ls_headspec_conformance_run calls 1: gv_num
128func ls_kv(k: *u8, v: i64) -> i64 { gv_puts(k); gv_puts("=" as *u8); gv_num(v); gv_puts("\n" as *u8); return 0 }
130func ls_wr(b: *u8, off: i64, len: i64) -> i64
136func ls_eol(b: *u8, n: i64, i: i64) -> i64
147func ls_starts(b: *u8, off: i64, end: i64, lit: *u8) -> i64
161func ls_litlen(lit: *u8) -> i64 { var j: i64 = 0; while lit[j] != (0 as u8) { j = j + 1 } return j }
called by 1: ls_slice_is
163func ls_slice_is(b: *u8, off: i64, len: i64, lit: *u8) -> i64
168func ls_streq(a: *u8, b: *u8) -> i64
called by 1: main
182func ls_nfields(b: *u8, off: i64, end: i64) -> i64
190func ls_field(b: *u8, off: i64, end: i64, k: i64, out: *i64) -> i64
208func ls_dup(b: *u8, off: i64, len: i64) -> *u8
called by 1: spec_conformance_run calls 1: sys_mmap
217func ls_int_after_eq(b: *u8, off: i64, len: i64) -> i64
241func ls_readable(p: *u8) -> i64
248func ls_write_slice(path: *u8, b: *u8, off: i64, len: i64) -> i64
258func ls_head(path: *u8, cap: i64) -> i64
273func ls_verd_name(v: i64) -> *u8
280func ls_reason_name(r: i64) -> *u8
295func ls_kind_name(k: i64) -> *u8
303func ls_find_clause(L: *i64, nl: i64, sb: *u8, ub: *u8, off: i64, len: i64) -> i64
332func spec_conformance_run(specp: *u8, suitep: *u8, cc: *u8, do_run: i64, confp: *u8) -> i64
702func ls_usage() -> i64
called by 1: main calls 1: ls_p
713func ls_list(specp: *u8, suitep: *u8, want_cases: i64) -> i64
737func main(argc: i64, argv: *i64) -> i64