{"id":27708482,"url":"https://github.com/maresmar/procpluslog","last_synced_at":"2025-09-08T08:44:27.522Z","repository":{"id":148264806,"uuid":"90055040","full_name":"maresmar/ProCplusLog","owner":"maresmar","description":"Prolog interpret in C++","archived":false,"fork":false,"pushed_at":"2017-05-02T23:13:40.000Z","size":259,"stargazers_count":3,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-08-31T21:37:24.349Z","etag":null,"topics":["command-line","interpreter","prolog-interpreter"],"latest_commit_sha":null,"homepage":null,"language":"C++","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/maresmar.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":"2017-05-02T16:32:36.000Z","updated_at":"2025-03-14T12:07:25.000Z","dependencies_parsed_at":"2023-05-25T21:00:22.320Z","dependency_job_id":null,"html_url":"https://github.com/maresmar/ProCplusLog","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/maresmar/ProCplusLog","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/maresmar%2FProCplusLog","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/maresmar%2FProCplusLog/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/maresmar%2FProCplusLog/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/maresmar%2FProCplusLog/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/maresmar","download_url":"https://codeload.github.com/maresmar/ProCplusLog/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/maresmar%2FProCplusLog/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":274159434,"owners_count":25232635,"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-09-08T02:00:09.813Z","response_time":121,"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":["command-line","interpreter","prolog-interpreter"],"created_at":"2025-04-26T10:14:08.105Z","updated_at":"2025-09-08T08:44:27.508Z","avatar_url":"https://github.com/maresmar.png","language":"C++","funding_links":[],"categories":[],"sub_categories":[],"readme":"# ProCplusLog\nProCplusLog is Prolog interpret and library written in C++. Work could be divided into two parts. First part is standalone Prolog library in C++ and second part is the user interface that uses this library. \n\n## User interface\n### Syntax\nThe program uses standard SWI-Prolog syntax. Composed terms start with a lower case letter and variable with an upper case letter. You can use the list and anonymous variables.\n\n~~~Prolog\n% commnet line\n% composed term with three variables and one atom\nfact(Variable, atom, AnotherVariable, _).\n% rules\nrule(X,Y):-foo(X),bar(Y).\nrule(X,_):-bar(X),!. % Prolog cut\n% Example of list (same list in three forms)\nsth([first,second,third]):-same([first,second|third]),same([first|[second|[third|[]]]]).\nterm(inner(foo),foo(foo(X))).\n~~~\n\nThe Prologue cut `!` is also supported but you cannot use functions working with the database, infix functions or unify/non-unify function eg. `\\=`.\n\n### How to use app\nThe program needs command line argument, which specifies an input file. The internal rule database is created from this file. When the file is loaded, the application shows input line where you can write Prolog question.\n\n~~~Prolog\n?-first_question(X),second_question(Y).\n~~~\n\nThe program could be exited by writing `halt.`\n\n# Standalone Prolog library\nLibrary developer entry point is in `ProCplusLog.hpp`. Here you can work with `composed_terms` and `variable_terms`. Every object has a template parameter which specifies the type of term functors and names of variables. So you can have `foo(bar)` or `51(10)` or whatever you want and has `operator==` (for printing it should also support `std::ostream\u0026 operator\u003c\u003c (std::ostream\u0026 stream, const T\u0026 sth)`)\n\n~~~C++\nprolog::composed_term\u003c\u003e foo(\"foo\");\nprolog::variable_term\u003c\u003e X(\"X\");\nprolog::variable_term\u003c\u003e Y(\"Y\");\nfoo.add_arg(X);\nfoo.add_arg(Y);\n// Creates foo(X,Y)\n\nprolog::composed_term\u003c\u003e another(\"fool\");\nanother.add_arg(prolog::composed_term\u003c\u003e(\"sth\"));\nanother.add_arg(prolog::variable_term\u003c\u003e(\"Var\"));\n\nprolog::result_bindings\u003c\u003e bindings;\nbool b = prolog::unify(foo, another, bindings); // = true\n\nfor (const auto\u0026 bin : bindings)\n    if(bin.second.second.is_default_construed()) // is binded to variable? (or term)\n        std::cout \u003c\u003c bin.first \u003c\u003c \" -\u003e \" \u003c\u003c bin.second.first \u003c\u003c std::endl; // Prints binded variable\n    else\n        std::cout \u003c\u003c bin.first \u003c\u003c \" -\u003e \" \u003c\u003c bin.second.second \u003c\u003c std::endl; // Prints binded term\n/*\nX -\u003e sth\nY -\u003e M\nM -\u003e M\n*/\n~~~\nFor more examples and demos see [PrologTests.cpp file](https://github.com/mmrmartin/ProCplusLog/blob/master/ProCplusLog/PrologTests.cpp). You can also use `rules` and `database` to store terms and search terms. And `solver` for looking for solutions (gives you results to your question based on the database).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmaresmar%2Fprocpluslog","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmaresmar%2Fprocpluslog","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmaresmar%2Fprocpluslog/lists"}