I’m trying to run sicstus code on swi-prolog . I have used “:- expects_dialect(sicstus).” ,but i get errors regarding some library predicates. I was able to get some swi-prolog equivalent of sicstus predicates , but not all (eg: domain/3). Isn’t :- expects_dialect(sicstus) supposed to make sicstus compatible ?
Thanks
No. It is supposed to create a framework to achieve compatibility that has been filled in mostly porting one giant application. So, what you should do is to extend that with the things your application needs. I recently described how do that for the similar XSB framework. It doesn’t apply fully, but the idea is close enough:
So, to port a program
- Load it using
swipl myprog.P
. - Watch errors and warnings, notably from
import
- If a predicate is missing
- If it is built-in for XSB, add it to library(dialect/xsb)
- If it is in the XSB library, extend/add
library(dialect/xsb/Module.pl)
If a new file is added, also add this to src/CMakeLists.txt
(search for one of the others)
- Run
?- list_undefined.
to find additional missing predicates
and proceeds as above.
Now the program might work. It is also possible that there are semantic
differences between predicates. If this is a library predicate, add it
to the xsb dialect library. If it is built-in, see library(dialect/xsb)
for a context dependent redefinition.
Please create a pull request for what you add. If you have questions
how to deal with something, do not hesitate to ask.
Is the code in a public repo?
After a brief analysis of the code, the “only” significant portability hurdle seems to be the differences between SICStus Prolog and SWI-Prolog library(clpfd)
.