# Grammar Fixtures These fixtures define the accepted and rejected surface grammar before parser implementation. They are readable ASCII mirrors of Nova128 source. Later PETSCII conversion tests must derive from these sources rather than replacing them as the authoritative text. Run the structural check from `newLang/`: ```powershell powershell -NoProfile -ExecutionPolicy Bypass -File tests/grammar/validate.ps1 ``` The validator enforces the Vim editor profile for every `.n8` fixture: - base name at most 12 characters; - at most 80 ASCII bytes per logical line; - at most 18,999 source bytes; - at most 599 logical lines; - one symbolic diagnostic expectation for every rejected fixture; - no diagnostic sidecars for accepted fixtures. `.expect` files deliberately use symbolic diagnostic names. Story E02-S04 will assign stable numeric codes without requiring grammar fixtures to guess them. ## Accepted Coverage | Production or form | Fixture evidence | |---|---| | Empty file body and program declaration | `accepted/minimal.n8` | | Comment and EOL | `accepted/minimal.n8` | | Interface declaration and method signatures | `decls.n8`, `forward.n8` | | Class declaration and `implements` list | `decls.n8` | | Forward top-level type reference | `forward.n8` | | Field declaration, access, and fixed array type | `decls.n8` | | Default field/method access | `nulls.n8` | | Method declaration, parameters, locals, result type | `decls.n8`, `stmts.n8` | | `init` and `destroy` declarations | `decls.n8` | | Program variable declarations | all non-minimal accepted fixtures | | Assignment to local, field, and array element | `stmts.n8`, `arrays.n8` | | Call statement and call expression | `stmts.n8` | | `if`, `else`, and `end if` | `decls.n8`, `stmts.n8`, `exprs.n8` | | `if` without `else` | `exprs.n8` | | `while` | `stmts.n8` | | `for` with and without `step` | `stmts.n8` | | `return` with and without a value | `decls.n8`, `nulls.n8` | | `print` literal and scalar | `stmts.n8`, `exprs.n8` | | `delete` concrete and interface references | `stmts.n8`, `decls.n8` | | `new` expression and constructor arguments | `decls.n8`, `stmts.n8` | | Member access, method call, and array indexing | `decls.n8`, `arrays.n8` | | Parentheses and all documented operator levels | `exprs.n8` | | Decimal number, string escape, character literal, booleans, and `null` | `exprs.n8`, `decls.n8`, `nulls.n8` | Hexadecimal and binary numeric forms are lexer behavior and belong to E02-S02 token fixtures, not parser grammar coverage. ## Rejected Coverage | Required rejection | Fixture | Expected symbolic diagnostic | |---|---|---| | Missing program terminator | `miss_end.n8` | `SYN_EXPECTED_END_PROGRAM` | | Invalid expression continuation | `line_cont.n8` | `SYN_UNEXPECTED_EOL` | | Duplicate declaration | `dup_decl.n8` | `SEM_DUPLICATE_NAME` | | Malformed interface header | `bad_iface.n8` | `SYN_EXPECTED_IDENTIFIER` | | Malformed class header | `bad_class.n8` | `SYN_EXPECTED_INTERFACE_NAME` | | Missing method terminator | `miss_meth.n8` | `SYN_EXPECTED_END_METHOD` | | Missing `if` terminator | `miss_if.n8` | `SYN_EXPECTED_END_IF` | | Missing class terminator | `miss_class.n8` | `SYN_EXPECTED_END_CLASS` | | Multiple statements on one line | `multi_stmt.n8` | `SYN_EXPECTED_EOL` | | Interface method body | `iface_body.n8` | `SYN_INTERFACE_METHOD_BODY` | | Malformed method parameter list | `bad_method.n8` | `SYN_EXPECTED_RPAREN` | | Character literal with multiple characters | `bad_char.n8` | `LEX_BAD_CHAR_LITERAL` | ## Future Parser Contract Accepted fixtures must parse and pass declaration-level semantic checks. Rejected fixtures assert the first primary diagnostic named in their sidecar; later recovery diagnostics do not invalidate that expectation.