{"id":18885442,"url":"https://github.com/dagit/rust-prolog","last_synced_at":"2025-07-02T22:33:04.276Z","repository":{"id":66389445,"uuid":"43730380","full_name":"dagit/rust-prolog","owner":"dagit","description":"Rust implementation of prolog based on miniprolog: http://andrej.com/plzoo/html/miniprolog.html","archived":false,"fork":false,"pushed_at":"2020-08-28T22:22:25.000Z","size":102,"stargazers_count":80,"open_issues_count":5,"forks_count":2,"subscribers_count":5,"default_branch":"master","last_synced_at":"2025-04-14T21:47:06.054Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"Rust","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"bsd-3-clause","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/dagit.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,"zenodo":null}},"created_at":"2015-10-06T04:47:30.000Z","updated_at":"2024-12-10T23:51:04.000Z","dependencies_parsed_at":"2023-03-13T20:29:49.707Z","dependency_job_id":null,"html_url":"https://github.com/dagit/rust-prolog","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/dagit/rust-prolog","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dagit%2Frust-prolog","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dagit%2Frust-prolog/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dagit%2Frust-prolog/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dagit%2Frust-prolog/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/dagit","download_url":"https://codeload.github.com/dagit/rust-prolog/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dagit%2Frust-prolog/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":263226182,"owners_count":23433651,"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","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":[],"created_at":"2024-11-08T07:18:49.628Z","updated_at":"2025-07-02T22:33:04.257Z","avatar_url":"https://github.com/dagit.png","language":"Rust","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Overview\nRust implementation of prolog (originally) based on miniprolog: http://andrej.com/plzoo/html/miniprolog.html\n\nI translated miniprolog from the above SML sources to Rust for two primary reasons:\n\n  * Firstly, I wanted a project to explore programming in Rust\n  * Secondly, prolog is interesting but I never felt like I properly learned it\n\nStarting from an existing implementation was nice because it shortened the time to a working\nversion. The current version in this repository is very much a work in progress and overly simplistic.\nI plan to improve it to better learn Rust and I plan to improve it as I learn Rust :)\n\nIn other words, this is really a playground for me to play with both Rust and prolog.\n\n# Installation\n\nTested on Linux (Fedora), OSX, and Windows.\n\nShould be as simple as: `cargo run`\n\n# Example\n\n```\n$ cargo run\nWelcome to rust-prolog!\nThis prolog interpreter is based on the ML code at the PLZoo:\n  http://andrej.com/plzoo/html/miniprolog.html\n\nInput syntax: \n    ?- query.            Make a query.\n    a(t1, ..., tn).      Assert an atomic proposition.\n    A :- B1, ..., Bn.    Assert an inference rule.\n    $quit                Exit interpreter.\n    $use \"filename\"      Execute commands from a file.\nProlog\u003e $use \"src/likes.pl\"\nProlog\u003e ?- likes(X,Y).\nY = mary\nX = john \n\nmore? (y/n) [y] \n```\n\n# Roadmap\n\nI haven't figured out exactly which directions I want to take this in, but some\nideas I've been kicking around include:\n\n  * [ ] Add a [type system](http://www.cs.bham.ac.uk/~udr/papers/TypedProlog.pdf)\n  * [ ] Add constraints and constraint checker.\n  * [ ] Add a bottom-up search procedure (perhaps even replace the existing\n    top-down search procedure entirely).\n  * [ ] Add program transformations to generate more efficient queries (for\n    instance, magic sets and entailment elimination).\n  * [ ] Change the syntax to one that supports mixfix declarations.\n\nCompleted:\n\n  * [x] Change the search procedure to a [complete search](http://www.ai.sri.com/~stickel/pttp.html).\n    This is now done. It uses iterative deepening with an admissable heuristic\n    that does a lower bound estimate on the number of unifications required to\n    solve the current goal. It also generates contrapositives (instead of using\n    restarts).\n  * [x] Add more primitive types, lists, numbers, etc and make a small standard library.\n  * [x] Improve the garbage collection. Currently cycles are allowed but due to\n    the hash consing, nothing is ever collected. A simple scheme that should\n    allow some collection is to throw away terms generated by unification\n    and terms that are part of a query after the query has terminated. This\n    should lend itself to a simplistic form of regions.\n\nOld goals that I may not pursue after all:\n\n  * [ ] Compile to the [Warren Abstract Machine](http://wambook.sourceforge.net/).\n    The reason I've reconsidered this one is because my search procedure is\n    slowing moving towards a more general constraint logic search procedure. The\n    WAM is still rather elegant and I may follow the development at some point\n    and see if I can adapt it to fit the general CPL algorithm. Perhaps someone\n    else has already done this work.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdagit%2Frust-prolog","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdagit%2Frust-prolog","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdagit%2Frust-prolog/lists"}