{"id":17662727,"url":"https://github.com/naereen/tiny-prolog-in-ocaml","last_synced_at":"2025-10-11T16:12:32.125Z","repository":{"id":94053112,"uuid":"125874899","full_name":"Naereen/Tiny-Prolog-in-OCaml","owner":"Naereen","description":"A tiny implementation of a small subset of the Prolog language, 🐫 in OCaml. With small and fun examples.","archived":false,"fork":false,"pushed_at":"2018-04-04T08:28:41.000Z","size":45,"stargazers_count":6,"open_issues_count":0,"forks_count":1,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-05-07T19:48:44.937Z","etag":null,"topics":["agregation","exemples","francais","ocaml","ocaml-library","prolog"],"latest_commit_sha":null,"homepage":"https://naereen.github.io/Tiny-Prolog-in-OCaml/","language":"Jupyter Notebook","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Naereen.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2018-03-19T14:55:47.000Z","updated_at":"2024-12-07T13:36:52.000Z","dependencies_parsed_at":"2023-03-05T08:30:43.704Z","dependency_job_id":null,"html_url":"https://github.com/Naereen/Tiny-Prolog-in-OCaml","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/Naereen/Tiny-Prolog-in-OCaml","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Naereen%2FTiny-Prolog-in-OCaml","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Naereen%2FTiny-Prolog-in-OCaml/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Naereen%2FTiny-Prolog-in-OCaml/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Naereen%2FTiny-Prolog-in-OCaml/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Naereen","download_url":"https://codeload.github.com/Naereen/Tiny-Prolog-in-OCaml/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Naereen%2FTiny-Prolog-in-OCaml/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":279007785,"owners_count":26084364,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-10-11T02:00:06.511Z","response_time":55,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["agregation","exemples","francais","ocaml","ocaml-library","prolog"],"created_at":"2024-10-23T18:23:25.865Z","updated_at":"2025-10-11T16:12:32.096Z","avatar_url":"https://github.com/Naereen.png","language":"Jupyter Notebook","funding_links":[],"categories":[],"sub_categories":[],"readme":"# [Tiny-Prolog-in-OCaml](https://github.com/Naereen/Tiny-Prolog-in-OCaml)\n\u003e A tiny implementation of a small subset of the Prolog language, in OCaml. With small and fun examples.\n\u003e\n\u003e WARNING: this project only has an **educational purpose**, for a real-world use of Prolog, please refer to [GNU Prolog (gprolog)](http://gprolog.org/).\n\nThis project contains [the code](prolog/) and [examples](examples/) for a tiny [Prolog](https://en.wikipedia.org/wiki/Prolog) implementation, written in [the OCaml language](https://ocaml.org/).\n\n- See [this folder](prolog/) for instructions to build the project (really easy: clone, run `make`, relax and enjoy :tada:). The implementation focuses on a very small subset of Prolog, see the examples for a good idea of what is supported.\n- See [this other folder](examples/) for examples (in English).\n\n## Example\n- A theory has this form, first with axioms (predicate):\n```prolog\ncat(tom).\nmouse(jerry).\n```\n- Then maybe some rules, stating that [a mouse is fast and a cat can be stupid](https://en.wikipedia.org/wiki/Tom_and_Jerry):\n```prolog\nfast(X) \u003c-- mouse(X).\nstupid(X) \u003c-- cat(X).\n```\n\n- If you save this file (see [this example](examples/tomandjerry.pl)), you can then load it with the `prolog` binary:\n\n```bash\n$ ./prolog/prolog ./examples/tomandjerry.pl\n?- stupid(tom).\n  { }\ncontinue ? (o/n) [o] :\n```\n\n- This `{ }` is an empty model, meaning that `stupid(tom).` evaluates to True in an empty model (no need for instanciation).\n- You can also ask your question directly in the command line:\n```bash\n$ ./prolog/prolog ./examples/tomandjerry.pl \"fast(tom).\"\n?- fast(tom).\n```\n- An empty response mean that the term is false, no matter the model.\n\n- You can add more rules, as you want.\n```prolog\nishuntedby(X, Y) \u003c-- mouse(X), cat(Y).\n```\n```bash\n$ ./prolog/prolog ./examples/tomandjerry.pl \"ishuntedby(tom, jerry).\"\n?- ishuntedby(tom, jerry).\n$ ./prolog/prolog ./examples/tomandjerry.pl \"ishuntedby(jerry, tom).\"\n?- ishuntedby(jerry, tom).\n  { }\n```\n\n- You can also add comments, that are lines starting with one or more `#` character.\n```prolog\n# the mouse always espace the cat!\nistrickedby(X, Y) \u003c-- cat(X), mouse(Y).\n```\n\n## More example\n- See [this folder](examples/),\n- Or [this notebook](example.ipynb).\n\n---\n\n### :scroll: License ? [![GitHub license](https://img.shields.io/github/license/Naereen/Tiny-Prolog-in-OCaml.svg)](https://github.com/Naereen/Tiny-Prolog-in-OCaml/blob/master/LICENSE)\nThis (small) repository is published under the terms of the [MIT license](http://lbesson.mit-license.org/) (file [LICENSE](LICENSE)).\n© [Lilian Besson](https://GitHub.com/Naereen), 2018.\n\n[![Maintenance](https://img.shields.io/badge/Maintained%3F-yes-green.svg)](https://GitHub.com/Naereen/Tiny-Prolog-in-OCaml/graphs/commit-activity)\n[![Ask Me Anything !](https://img.shields.io/badge/Ask%20me-anything-1abc9c.svg)](https://GitHub.com/Naereen/Tiny-Prolog-in-OCaml)\n[![Analytics](https://ga-beacon.appspot.com/UA-38514290-17/github.com/Naereen/Tiny-Prolog-in-OCaml/README.md?pixel)](https://GitHub.com/Naereen/Tiny-Prolog-in-OCaml/)\n\n[![made-with-OCaml](https://img.shields.io/badge/Made%20with-OCaml-1f425f.svg)](https://ocaml.org/)\n[![made-for-teaching](https://img.shields.io/badge/Made%20for-Teaching-6800ff.svg)](https://perso.crans.org/besson/teach/)\n\n[![ForTheBadge built-with-science](http://ForTheBadge.com/images/badges/built-with-science.svg)](https://GitHub.com/Naereen/)\n[![ForTheBadge uses-badges](http://ForTheBadge.com/images/badges/uses-badges.svg)](http://ForTheBadge.com)\n[![ForTheBadge uses-git](http://ForTheBadge.com/images/badges/uses-git.svg)](https://GitHub.com/)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnaereen%2Ftiny-prolog-in-ocaml","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fnaereen%2Ftiny-prolog-in-ocaml","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnaereen%2Ftiny-prolog-in-ocaml/lists"}