SWIPL-OCaml

SWI-Prolog Bindings for OCaml: https://gopiandcode.github.io/SWIPL-OCaml/swipl/index.html

GPL-3.0 License

Stars
6

SWIPL-OCaml

SWIProlog bindings for OCaml (for SWIProlog version 8.5).

(* initialise SWIProlog *)
let () = Swipl.initialise ()
(* setup the prolog database with some facts *)
let () = Swipl.load_source "hello :- writeln('hello world')."
(* construct a Swipl term in OCaml *)
let hello = Swipl.Syntax.(!"hello")
(* send the term to the Prolog engine *)
let () = Swipl.with_ctx @@ fun ctx -> Swipl.call ctx hello

Check out the Documentation page for a detailed introduction and quick start guide!

If you know what you're doing already, then maybe check out the example uses under examples/.