Calibre.FormulaEngine 0.1.0
Calibre.FormulaEngine
Domain-neutral formula calculation engine as a pure .NET library (net10.0, zero runtime dependencies). It knows nothing about salary, leave, loans, or any other domain — consumers (payroll, attendance, lending, accounting) layer their own contracts and content on top.
Pipeline
DSL text → Parser → AST (canonical JSON form) → dependency extraction
→ DAG build + topological sort + cycle rejection
→ compile to expression-tree delegates → cached execution (+ calculation trace)
The AST is the canonical artifact: formula text pretty-prints from it, builder UIs emit it, the validator validates it, hosts store and hash it. See Calibre.FormulaEngine.Serialization.AstJsonSerializer for the canonical JSON contract and AstHash for content hashing.
Design laws (identity of this package)
- Pure — no database, no clock, no network, no file or config I/O. The host hydrates an
EvaluationContext(values, quantities, policies, rates, slab tables, dates, resolvers); the engine only computes. Same inputs + same versions = same outputs, forever. - Zero persistence — not even repository interfaces. Hosts own storage.
- Zero domain concepts — no "employee", no "salary". Ever.
- Decimal arithmetic only, explicit rounding at defined points.
- Not Turing-complete — no loops, no mutation, no state. Formulas express math over resolved data; imperative data resolution is the host's job.
- Strict SemVer — the public API surface and the canonical JSON form are contracts; breaking either is a major version bump.
Build
dotnet build Calibre.FormulaEngine.slnx
dotnet test Calibre.FormulaEngine.slnx
dotnet pack src/Calibre.FormulaEngine -c Release -o artifacts
Status
| Stage | State |
|---|---|
| AST node model + canonical JSON + hashing | ✅ |
| Evaluation context object model | ✅ |
| Parser (DSL → AST) | ⏳ pending AST schema review |
| Dependency extractor, DAG builder, cycle detection | ⏳ |
| Expression-tree compiler + delegate cache | ⏳ |
| Validator + test-vector runner | ⏳ |
No packages depend on Calibre.FormulaEngine.
.NET 10.0
- No dependencies.
| Version | Downloads | Last updated |
|---|---|---|
| 0.1.0 | 2 | 07/06/2026 |