View on GitHub

Tiny-Prolog-in-OCaml

A tiny implementation of a small subset of the Prolog language, 🐫 in OCaml. With small and fun examples.

This folder contains the source code of Tiny-Prolog-in-OCaml

A tiny implementation of a small subset of the Prolog language, in OCaml. With small and fun examples.

WARNING: this project only has an educational purpose, for a real-world use of Prolog, please refer to GNU Prolog (gprolog).

Requirements

How to build

$ cd /tmp/
$ git clone https://github.com/Naereen/Tiny-Prolog-in-OCaml
$ cd Tiny-Prolog-in-OCaml
$ cd prolog
$ make prolog
ocamlc -pp camlp4o -c lib.ml
ocamlc on -pp camlp4o -c lib.ml
ocamlc lib.cmo -c resolution.ml
ocamlc on lib.cmo -c resolution.ml
ocamlc -o prolog lib.cmo resolution.cmo prolog.ml
ocamlc on -o prolog lib.cmo resolution.cmo prolog.ml
$ make clean
$ file prolog
prolog: a ocamlrun script executable (binary data)

List of files


How to use prolog

How to test

cd ..
cd exemples
../prolog/prolog ./pair.pl "pair(o)."  # load a theory and ask a question
../prolog/prolog ./impair.pl "impair(o)."  # load a theory and ask a question
../prolog/prolog ./famille.pl "ancetre(X,renaud)."  # load a theory and ask a question

:scroll: License ? GitHub license

This (small) repository is published under the terms of the MIT license (file LICENSE). © Lilian Besson, 2018.

Maintenance Ask Me Anything ! Analytics

made-with-OCaml made-for-teaching

ForTheBadge built-with-science ForTheBadge uses-badges ForTheBadge uses-git