6a98d8ce9e
grammar.ts:
- Replace 2 parseAssertion console.warn + return-null patterns with
this.errorWithCode() throws, producing structured ParseError
diagnostics instead of silently skipping invalid clauses
- Maintain parseBlock's return-null contract for unmatched tokens
(caller loops over tokens expecting null for non-block starters)
compiler.ts:
- buildOptionsFromAssertion: convert 3 standalone ifs to if/else if/else
with never-exhausted throw on unknown assertion type
- compileToFormula: replace silent return-null with throw on unknown
assertion type
validator.ts:
- validateAssertion: replace silent return {valid:true} for unknown
assertion types with throw
fol-compiler.ts:
- compileSingleAssertion: replace silent return-null with throw
Golden equivalence tests (fol-equivalence-golden.test.ts):
7 new deterministic tests covering gaps identified in REFACTOR item 5:
- Size assertions: atLeast, atMost, between (fluent vs dense)
- Compound assertions: .and chain, .or chain
- Options: gap, tolerance in jnd
Documents known discrepancy: fluent size.* prefix vs dense canonical name
(fol-compiler normalizes at FormulaNode level, canonical path does not)
Existing property-based equivalence tests cover spatial, quantifier,
and frame equivalence. Topology predicates have no fluent API surface
(dense-DSL-only), so equivalence must be verified at evaluation level
(already covered by hard E2E topology tests).
662 tests pass (315 DSL + 141 core + 149 solver + 57 E2E).
imhotep-dsl
Domain-specific language for Imhotep assertions. Provides a fluent assertion API, a dense string-based DSL parser, FOL compilation/validation, canonical lowering, and property-run builders.
Key Exports
| Export | Description |
|---|---|
expect(subject) |
Fluent assertion builder |
spec(src) |
Dense DSL parser (parseSpec alias) |
compile(source) |
Compile DSL to assertion nodes |
compileDenseFOLToFormula(src) |
Compile dense FOL to solver-ready AST |
validateAssertion(node) |
Pre-flight validation without extraction |
lowerToCanonical(nodes) |
Canonical lowering for IR equivalence |
component, enumerate |
Property-run fluent builders |
forAll, exists, predicate, domain |
FOL fluent builders |