Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/lukaspietzschmann/zigchr
A FreeCHR instance written in Zig
https://github.com/lukaspietzschmann/zigchr
constraint-programming zig
Last synced: 18 days ago
JSON representation
A FreeCHR instance written in Zig
- Host: GitHub
- URL: https://github.com/lukaspietzschmann/zigchr
- Owner: LukasPietzschmann
- License: bsd-3-clause
- Created: 2024-09-17T19:23:34.000Z (3 months ago)
- Default Branch: main
- Last Pushed: 2024-10-20T11:49:28.000Z (2 months ago)
- Last Synced: 2024-12-09T09:11:11.966Z (20 days ago)
- Topics: constraint-programming, zig
- Language: Zig
- Homepage: https://lukas.pietzschmann.org/talks/zigtoberfest
- Size: 61.5 KB
- Stars: 3
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# ZigCHR
For the [talk](https://github.com/LukasPietzschmann/zigtoberfest-talk) I gave at Zigtoberfest 2024, I coded up a CHR embedding for Zig using the
FreeCHR framework.If you want to learn more about FreeCHR, go ahead and read [this
paper](https://doi.org/10.1007/978-3-031-45072-3_14). If you want to know more about
cool properties that CHR can bring to your algorithms, visit [my website for the
talk](https://lukas.pietzschmann.org/talks/zigtoberfest)## Project Structure
- `src/`: Here you can find two example on how to use the embedding.
- `lib/`: The embedding itself.
- `utils/`: Some useful data structures and functions unrelated to CHR.## How to build it
For each file inside the `src` directory, there exists a step. So lets say you want to
build and run the _min_ example. You can run `zig build min` to do so. For all examples
present in this repo, you can pass the query constraints though the commandline like the
following: `zig build min -- 1 3 5`.If you add your own file in the `src` folder, the build system will automatically
generate a step for you.### Additional flags
You can pass different flags to the build process to control how much logs the embedding
produces:- `-Dlog` enabled logging. The embedding will print which rules were fired with which
constraints, whats put into the store, ...
- `-Dnotag` wont print a constraints tag.
- `-Dmatchings` requires `-Dlog`. The embedding will print what combination of
constraints are considered.
- `-Dstore` requires `-Dlog`. The embedding will print the constraint store when it's
modified.