Description
Crepe is a Rust library for writing declarative logic programs with a Datalog-like syntax. Its crepe! procedural macro compiles the rules into Rust code, so the logic is built together with the rest of your program and can call ordinary Rust functions. The README lists semi-naive evaluation, stratified negation, automatic index generation for relations, calls to Rust functions from within rules, and a typesafe way to initialise @input relations. A short example computes the transitive closure of a directed graph from an Edge input and a Reachable output. The README says the generated code is fast, and that its benchmarks run at comparable speed to compiled Souffle while needing a fraction of the compilation time. The macro generates a Crepe struct and a struct for each declared relation, so the README suggests putting it in its own module. Benchmarks can be run with cargo bench. The author says the project was heavily inspired by Souffle and Formulog, which use similar Datalog compilation models for static analysis.…
Highlights
- Datalog-style rules compiled by a Rust macro
- Semi-naive evaluation and stratified negation
- Automatic indices for relations
- Call Rust functions from rules
Ratings & Reviews
No ratings yet
Be the first to rate Crepe.
People also visit
Crepe FAQ
What is Crepe?
A library for writing declarative logic programs in Rust, using a Datalog-like syntax.
How is it used?
You declare @input and @output relations and rules inside the crepe! macro. It generates a Crepe struct and a struct for each relation in the current module.
Is it fast?
The README says its benchmarks run at comparable speed to compiled Souffle, and use a fraction of the compilation time.
Can rules call Rust code?
Yes. The README says Rust functions can be called easily from within Datalog rules.
What was it inspired by?
Souffle and Formulog, which the README names as using similar Datalog compilation models for static analysis.
What are the best Crepe alternatives?
Popular alternatives to Crepe include Rust Playground, Scryer Prolog and Competitive Programming RS. See all Crepe alternatives



