speckl/examples
Scott Scoble a910f07377 feat: add SQL query optimizer with functional runtime
SQLOptimizer.speckdl: state machine spec for the optimizer pipeline
(Parsing → Rewriting → Planning → Generating → Done, plus Failed)

SQLOptimizer-runtime.ts: working TypeScript runtime that actually
optimizes SQL queries:
- Parses SELECT/FROM/JOIN/WHERE/GROUP BY/ORDER BY/LIMIT
- Builds plan trees with cardinality estimation
- Predicate pushdown (splits AND predicates per table)
- Constant folding (evaluates arithmetic in predicates)
- Column pruning
- Physical operator selection (hash/merge/nested_loop joins)
- Cost estimation per plan node
- SQL generation from optimized plan tree

Known issues:
- Predicate pushdown needs to split AND predicates per table
- FROM clause duplicate when both listed and joined
- Cost model needs tuning (hash join startup cost shouldn't exceed
  nested loop savings for medium inputs)

Both files pass tsc --noEmit clean.
2026-05-13 17:00:46 -07:00
..
.gitkeep Initial commit: Speckl project scaffold 2026-04-28 01:20:22 -07:00
AccessControl.speck Add SpeckDL examples with Dark Provenance primitives 2026-04-29 14:44:00 -07:00
AccountLedger.speck fix: add dist-check guard + List<T> type parsing + state machine examples 2026-05-05 03:11:53 -07:00
DrugDosageCalculator.speck Add SpeckDL examples with Dark Provenance primitives 2026-04-29 14:44:00 -07:00
KafkaKRaft.speck feat(z3): zero-error SMT-LIB2 output + BMC verify blocks for KRaft 2026-05-09 23:07:56 -07:00
OAuth2AuthorizationCode.speck feat: OAuth 2.0 authorization code flow with PKCE spec 2026-05-09 21:51:51 -07:00
Paxos.speck refactor: remove WAT/WASM generator (superseded by IR→Rust→WASM path) 2026-05-09 22:03:20 -07:00
PaymentService.speck Add SpeckDL examples with Dark Provenance primitives 2026-04-29 14:44:00 -07:00
PreconditionTest.speck refactor: remove WAT/WASM generator (superseded by IR→Rust→WASM path) 2026-05-09 22:03:20 -07:00
Raft.speck refactor: remove WAT/WASM generator (superseded by IR→Rust→WASM path) 2026-05-09 22:03:20 -07:00
RetryHandler.speck Add SpeckDL examples with Dark Provenance primitives 2026-04-29 14:44:00 -07:00
SQLitePager.speck fix(z3): robust = conversion + SQLite pager spec (DB.2) 2026-05-10 01:02:00 -07:00
SQLiteWAL.speck TS generator: fix #12 (5 expression patterns) + #11 (opaque record types) 2026-05-11 10:16:15 -07:00
SQLOptimizer-runtime.ts feat: add SQL query optimizer with functional runtime 2026-05-13 17:00:46 -07:00
SQLOptimizer.speckdl feat: add SQL query optimizer with functional runtime 2026-05-13 17:00:46 -07:00
TemperatureMonitor.speck Add SpeckDL examples with Dark Provenance primitives 2026-04-29 14:44:00 -07:00
TigerBeetleLedger.speck fix: add dist-check guard + List<T> type parsing + state machine examples 2026-05-05 03:11:53 -07:00
ToggleSwitch.speck fix: add dist-check guard + List<T> type parsing + state machine examples 2026-05-05 03:11:53 -07:00
TwoPhaseCommit.speck fix: add dist-check guard + List<T> type parsing + state machine examples 2026-05-05 03:11:53 -07:00