PceEmacs and CHR

CHR code is incorrectly highlighted in PceEmacs, and false errors are given.
(chr does not resolve predicates, facing/1 is undefined, etc).

Some sweeprolog made me guess that adding [library(chr)] to my initialization in ~/.config/swi-prolog/init.pl would help. But it doesn’t seem to make any difference.

Please include as text rather than image. No reason to let us type this …

:- use_module(library(chr)).

:- chr_type direction ---> up; right; down; left.
:- chr_constraint facing(+direction).
:- chr_constraint turn/0.

turn, facing(up)    <=> facing(right).
turn, facing(right) <=> facing(down).
turn, facing(down)  <=> facing(left).
turn, facing(left)  <=> facing(up).

Thanks. I’m not much of a CHR expert :frowning: It seems that one can have a CHR constraint by defining the constraint using chr_constraint/1 and not defining a rule for it. That is not handled by the cross-referencing extensions for CHR. Added a partial solution.

To refer to your other topic on a post you deleted: CHR maintenance is orphaned. That means there is no active support and issues need to be dealt with by the users or other incidental volunteers. Luckily, Tom is a very good programmer and only few issues came up over the years. Surely he is open to help a little, but I fear we cannot rely on his unlimited support. You can only rely that issues that result from bugs or incompatible changes to Prolog itself will be fixed.

1 Like