fuzz_lex_test.nx
buildroot/runtime/fuzz_lex_test.nx
about
fuzz_lex_test.nx -- mutational fuzz against lex_source.
Mutates valid NishiLang sources and feeds them to the lexer.
The lexer should ALWAYS return without crashing -- malformed
input may produce unexpected tokens, but it must never
dereference NULL or run off the end of the buffer.
This turns the theoretical "lex_source is robust" claim into
an empirical "we've tried 10,000 mutated inputs and none
crashed" result. If any run DOES crash, nx_assert fires and
we get a clean post-mortem + the exact seed for replay.
Seed corpus:
"func f() { return 42 }" -- minimal function
"let x: i64 = 100" -- let statement
"0xdeadbeef + 0b1010" -- mixed-base integers
"\"hello world\"" -- string literal
"if a < b { x = 1 }" -- control flow
"x[0].field" -- postfix chain
"// comment\nfunc g() {}" -- comment handling
"0.5 + 3.14f" -- floating-point literals
dependencies 5 imports · 0 importers
imports: syscalls.nxtypes.nxlex_kinds.nxlex.nxnx_fuzz.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
| 29 | const FUZZ_ITERS: i64 = 10000 |
| 30 | const FUZZ_MAX_INPUT: i64 = 1024 |
functions
| 32 | func main() -> i64 { |