ToyCHR is a very simple reference implementation of Constraint Handling
Rules (CHR) for Prolog using the refined operational semantics.
The toyCHR package contains two different CHR interpreters:
- toychr.pl -- a simple CHR compiler; and
- toychrdb.pl -- a simple CHR interpreter and trace
More information about CHR can be found at the
Disclaimer: ToyCHR is not a serious CHR implementation.
To implement CHR applications in Prolog, please use the
K. U. Leuven CHR System.
- toychr.pl -- Prolog (tested with Sicstus & SWI, but any
Prolog should be okay);
- toychrdb.pl --
- toychr.pl -- Cannot extend other constraint solvers,
so ground data only.
(Note that variables can be used as long as they are immediately bound the
first time the constraint is called.)
- toychrdb.pl -- No limitations, fully implements the refined
operational semantics of CHRs.
- gcd.chr -- One of the most basic CHR programs, it calculates
the greatest common divisor between two numbers.
- leq.chr -- Classic less-than-or-equal-to solver.
Note only works with toychrdb.pl for non-ground goals.
- ray.chr -- A very simple ray tracer implemented in CHRs.