{"id":13565744,"url":"https://github.com/tau-prolog/tau-prolog","last_synced_at":"2025-04-03T23:30:32.435Z","repository":{"id":37742959,"uuid":"112090854","full_name":"tau-prolog/tau-prolog","owner":"tau-prolog","description":"An open source Prolog interpreter in JavaScript","archived":false,"fork":false,"pushed_at":"2023-01-30T16:52:52.000Z","size":1953,"stargazers_count":557,"open_issues_count":77,"forks_count":53,"subscribers_count":24,"default_branch":"master","last_synced_at":"2024-05-17T18:44:56.286Z","etag":null,"topics":["iso-prolog-standard","javascript","logic-programming","prolog","prolog-implementation","prolog-interpreter","prolog-programming-language","tau-prolog"],"latest_commit_sha":null,"homepage":"http://tau-prolog.org","language":"JavaScript","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/tau-prolog.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}},"created_at":"2017-11-26T14:47:13.000Z","updated_at":"2024-05-02T06:12:38.000Z","dependencies_parsed_at":"2023-02-08T14:16:37.283Z","dependency_job_id":null,"html_url":"https://github.com/tau-prolog/tau-prolog","commit_stats":null,"previous_names":[],"tags_count":4,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tau-prolog%2Ftau-prolog","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tau-prolog%2Ftau-prolog/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tau-prolog%2Ftau-prolog/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tau-prolog%2Ftau-prolog/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/tau-prolog","download_url":"https://codeload.github.com/tau-prolog/tau-prolog/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":246939195,"owners_count":20857916,"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":["iso-prolog-standard","javascript","logic-programming","prolog","prolog-implementation","prolog-interpreter","prolog-programming-language","tau-prolog"],"created_at":"2024-08-01T13:01:54.483Z","updated_at":"2025-04-03T23:30:32.053Z","avatar_url":"https://github.com/tau-prolog.png","language":"JavaScript","funding_links":["https://www.paypal.com/donate/?hosted_button_id=JW48YT93SDLP8"],"categories":["JavaScript"],"sub_categories":[],"readme":"![Tau Prolog](http://tau-prolog.org/logo/tauprolog64.png \"Tau Prolog\")\n\n[![www](https://img.shields.io/badge/www-tau--prolog.org-442178)](http://tau-prolog.org)\n[![twitter](https://img.shields.io/badge/twitter-%40tau__prolog-blue)](https://twitter.com/tau_prolog)\n[![license](https://img.shields.io/github/license/tau-prolog/tau-prolog?color=green)](http://tau-prolog.org/license)\n[![npm version](https://img.shields.io/npm/v/tau-prolog?color=red \"npm version\")](https://www.npmjs.com/tau-prolog)\n[![donate](https://img.shields.io/badge/donate-paypal-yellow)](https://www.paypal.com/donate/?hosted_button_id=JW48YT93SDLP8)\n\n# Tau Prolog\n\n## A Prolog interpreter in JavaScript\n**Tau Prolog** is a client-side Prolog interpreter fully implemented in JavaScript, whose development has been directed by the ISO Prolog Standard.\n\n\u003e **ISO Prolog Standard compliance.** Tau Prolog development has been directed by the ISO Prolog Standard, designed to promote the applicability and portability of Prolog text and data among several data processing systems.\n\n\u003e **Compatible with browsers and Node.js.** Tau Prolog has been developed to be used with either Node.js or a browser seamlessly. Just use the `\u003cscript\u003e` tag or the `require` function to add Tau Prolog to your project and start coding.\n\n\u003e **DOM manipulation and event handling.** Taking the best from JavaScript and Prolog, Tau Prolog allows you to handle browser events and modify the DOM of a web using Prolog predicates, making Prolog even more powerful.\n\n\u003e **Asynchronous predicates.** Tau Prolog has been developed following a non-blocking, callback-based approach, allowing you, for instance, to sleep the main thread or to do AJAX requests without blocking the browser.\n\n## A brief look\n\n1. **Load the library**\n```html\n\u003cscript src=\"tau-prolog.js\"\u003e\u003c/script\u003e\n```\n2. **Create a session**\n```javascript\nvar session = pl.create();\n```\n3. **Consult a program**\n```javascript\nsession.consult(`\n    likes(sam, salad).\n    likes(dean, pie).\n    likes(sam, apples).\n    likes(dean, whiskey).\n`, {\n    success: function() { /* Program loaded correctly */ },\n    error: function(err) { /* Error parsing program */ }\n});\n```\nor\n```javascript\nsession.consult(\"path/to/src.pl\", {\n    success: function() { /* Program loaded correctly */ },\n    error: function(err) { /* Error parsing program */ }\n});\n```\n4. **Query a goal**\n```javascript\nsession.query(\"likes(sam, X).\", {\n    success: function(goal) { /* Goal loaded correctly */ },\n    error: function(err) { /* Error parsing goal */ }\n});\n```\n5. **Look for answers**\n```javascript\nsession.answer({\n    success: function(answer) {\n        console.log(session.format_answer(answer)); // X = salad ;\n        session.answer({\n            success: function(answer) {\n                console.log(session.format_answer(answer)); // X = apples ;\n            },\n            // ...\n        });\n    },\n    fail: function() { /* No more answers */ },\n    error: function(err) { /* Uncaught exception */ },\n    limit: function() { /* Limit exceeded */ }\n});\n```\n\nThis is a general scheme of how to use Tau Prolog:\n\n```javascript\n// Consult\nsession.consult(program, {\n    success: function() {\n        // Query\n        session.query(goal, {\n            success: function(goal) {\n                // Answers\n                session.answer({\n                    success: function(answer) { /* Answer */ },\n                    error:   function(err) { /* Uncaught error */ },\n                    fail:    function() { /* Fail */ },\n                    limit:   function() { /* Limit exceeded */ }\n                })\n            },\n            error: function(err) { /* Error parsing goal */ }\n        });\n    },\n    error: function(err) { /* Error parsing program */ }\n});\n```\n\nFor further information, check the [Documentation](http://tau-prolog.org/documentation).\n\n## Downloads\nYou can download a custom bundle including only the modules you need [here](http://tau-prolog.org/downloads#custom). Source code of Tau Prolog is available on [GitHub](/modules). You can also install Tau Prolog from [npm](https://www.npmjs.com/tau-prolog):\n```shell\n$ npm install tau-prolog\n```\n\n## Documentation\n\n### [**Get Started with Tau Prolog**](http://tau-prolog.org/documentation#manual)\n* [A simple tutorial](http://tau-prolog.org/manual/a-simple-tutorial)\n* [Compatibility with Node.js](http://tau-prolog.org/manual/compatibility-with-nodejs)\n* [Manipulating the DOM with Prolog](http://tau-prolog.org/manual/manipulating-the-dom-with-prolog)\n* [Making your own packages](http://tau-prolog.org/manual/making-your-own-packages)\n* [Promises interface](http://tau-prolog.org/manual/promises-interface)\n* [Prototypes and Prolog objects](http://tau-prolog.org/manual/prototypes-and-prolog-objects)\n\n### [**Prolog Predicate Reference**](http://tau-prolog.org/documentation#prolog)\n* [Built-in predicates](http://tau-prolog.org/documentation#builtin)\n* [Lists module](http://tau-prolog.org/documentation#lists)\n* [DOM module](http://tau-prolog.org/documentation#dom)\n* [Random module](http://tau-prolog.org/documentation#random)\n* [Statistics module](http://tau-prolog.org/documentation#statistics)\n* [JavaScript module](http://tau-prolog.org/documentation#js)\n* [OS module](http://tau-prolog.org/documentation#os)\n* [CharsIO module](http://tau-prolog.org/documentation#charsio)\n* [Format module](http://tau-prolog.org/documentation#format)\n* [Concurrent module](http://tau-prolog.org/documentation#concurrent)\n\n## License\nTau Prolog source code is released under the terms of the [BSD 3-Clause License](http://tau-prolog.org/license).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftau-prolog%2Ftau-prolog","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ftau-prolog%2Ftau-prolog","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftau-prolog%2Ftau-prolog/lists"}