An OCaml Derivation of the Warren Abstract Machine.
Language support is limited to pure Prolog i.e. predicate logic with Horn clauses.
This is a very simple & plain Prolog interpreter with no support for negation as failure, integers, lists, operators or built-in predicates.
Implementaion-wise, there is no tabling or memoization nor any type of term indexing. The core part of the interpreter is only ~100 LOC.
Install using the opam package manager:
opam install prolectThen run it, potentially with a consulting file:
prolect test.plIf you don't want to use opam, download the .exe from GitHub releases, add the executable attribute (chmod +x prolect.exe), and then:
./prolect.exeIf you don't want to use opam, download the .bc from GitHub releases, install the OCaml Runtime, and then:
ocamlrun prolect.bcIf you don't want to use the bytecode interpreter either, you can compile the project yourself (e.g. for getting a performance boost on other OSes).
First, install the dependencies (ocaml, dune, etc.). Then:
dune exec prolect --profile releaseTo get the executable:
dune build . --profile releaseRun the REPL:
_build/default/bin/prolect.exeProvided that you've given the test consulting file (i.e. running prolect test.pl instead of prolect):
Welcome to Prolect (version 1.1.3)
?- ancestor(terah, jacob).
true .
?- ancestor(terah, X).
X = sarah ;
X = abraham ;
X = isaac ;
X = jacob ;
X = isaac ;
X = ismael ;
X = jacob .
?- loves(sarah, X).
X = isaac ;
X = loves(sarah, isaac) ;
X = loves(sarah, loves(sarah, isaac)) .
?- ^C