cek-mercury: Demonstrative Prolog/Mercury relational engine for CEK machines

[ compilers-interpreters, language, library ] [ Propose Tags ] [ Report a vulnerability ]

An educational and demonstrative reference engine showcasing Prolog and Mercury relational unification, Warren Abstract Machine (WAM) conditional trailing, and nondeterministic search over unrolled KontStack choice points.

Notice: This package is provided primarily as an executable architectural example and documentation case study within the cek ecosystem.


[Skip to Readme]

Downloads

Maintainer's Corner

Package maintainers

For package maintainers and hackage trustees

Candidates

Versions [RSS] 0.1.0.2
Change log CHANGELOG.md
Dependencies base (>=4.18 && <5), cek-core (>=0.1.0.0 && <0.2), cek-pykinos (>=0.1.0.0 && <0.2), ghc-prim (>=0.10 && <0.14), primitive (>=0.9 && <0.10), pykinos-core (>=0.1.0.0 && <0.2) [details]
Tested with ghc ==9.14.1
License (EUPL-1.2 OR Apache-2.0)
Author Nadia Yvette Chambers
Maintainer nadia.yvette.chambers@ik.me
Uploaded by nyc at 2026-11-19T20:07:47Z
Category Language, Compilers/Interpreters
Home page https://github.com/NadiaYvette/cek
Bug tracker https://github.com/NadiaYvette/cek/issues
Source repo head: git clone https://github.com/NadiaYvette/cek(packages/cek-mercury)
Distributions
Downloads 3 total (3 in the last 30 days)
Rating (no votes yet) [estimated by Bayesian average]
Your Rating
  • λ
  • λ
  • λ
Status Docs uploaded by user
Build status unknown [no reports yet]

Readme for cek-mercury-0.1.0.2

[back to package description]

cek-mercury

Important Notice: This package is an educational and demonstrative reference implementation showcasing relational unification, Warren Abstract Machine (WAM) conditional trailing, and nondeterministic search over KontStack choice points. It is provided primarily as an executable architectural example within the cek ecosystem documentation.

Overview

cek-mercury implements a high-performance relational unification and search engine inspired by the Warren Abstract Machine (WAM) and Mercury's deterministic execution models, executing entirely over unboxed CEK data structures:

  1. Term Allocation Heap: Mapped onto the 4096-cell chunked SoAStore.
  2. Clause Dispatch Stack: Mapped onto the unrolled 32-frame KontStack.
  3. WAM Conditional Trailing: Bound variables allocate trail entries only if their address precedes the most recent choice point watermark (heapWatermark), bypassing trail overhead for transient intra-clause bindings.
  4. Delimited Commits (semidet): Mercury's deterministic commits (GOnce) prune intermediate choice points instantaneously by resetting the choice point watermark.

Module Structure

  • Cek.Mercury: Primary reference engine and AST definitions.
  • Cek.Examples.Mercury: Backward-compatibility re-export module.

Building and Testing

cabal build cek-mercury
cabal test cek-mercury:tests

License

EUPL-1.2.