{"id":15774952,"url":"https://github.com/thk2b/expert_system","last_synced_at":"2026-02-12T19:33:48.797Z","repository":{"id":138600896,"uuid":"158617792","full_name":"thk2b/expert_system","owner":"thk2b","description":null,"archived":false,"fork":false,"pushed_at":"2019-04-08T22:24:39.000Z","size":63,"stargazers_count":1,"open_issues_count":5,"forks_count":0,"subscribers_count":0,"default_branch":"master","last_synced_at":"2025-08-20T22:54:40.219Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/thk2b.png","metadata":{"files":{"readme":"readme.md","changelog":null,"contributing":null,"funding":null,"license":null,"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-11-21T23:27:35.000Z","updated_at":"2019-04-08T22:24:41.000Z","dependencies_parsed_at":"2024-04-13T05:03:31.579Z","dependency_job_id":null,"html_url":"https://github.com/thk2b/expert_system","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/thk2b/expert_system","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/thk2b%2Fexpert_system","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/thk2b%2Fexpert_system/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/thk2b%2Fexpert_system/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/thk2b%2Fexpert_system/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/thk2b","download_url":"https://codeload.github.com/thk2b/expert_system/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/thk2b%2Fexpert_system/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":29378819,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-02-12T19:05:20.189Z","status":"ssl_error","status_checked_at":"2026-02-12T19:01:44.216Z","response_time":55,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"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":[],"created_at":"2024-10-04T16:41:37.165Z","updated_at":"2026-02-12T19:33:48.782Z","avatar_url":"https://github.com/thk2b.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# expert system\n\nA propositional logic engine\n\n## Usage\n\n```\n$ ./expert_system -h\nusage: expert_system [-h] [--verbose] [filename [filename ...]]\n\npositional arguments:\n  filename       file to execute (default: stdin)\n\noptional arguments:\n  -h, --help     show this help message and exit\n  --verbose, -v  verbose mode-\n```\n\nAlterntively, run with `$ python3 expert_system`\n\nRun unit tests with `$ python3 test.py`\n\n## Examples\n\n```\n$ ./expert_system -v\ne\u003e a =\u003e b # if a then b\ne\u003e =a     # a is true\ne\u003e ?b     # what about b\nb is true because a is true\ne\u003e =      # nothing is true\ne\u003e ?b\nb is false\n```\n\n```\nA =\u003e B + C\nB =\u003e D | E\nC =\u003e ! E\n\n=A\n?D # true\n```\n\n## Syntax\n\nThe parser implements the following grammar:\n```\nGrammar\n    Sessions            = Session Sessions\n                        | EOF\n    Session             = Rules Statements Queries\n    Rules               = Rule Rules\n                        | NULL\n    Statements          = Statement Statements\n                        | NULL\n    Queries             = Query Queries\n                        | NULL\n\n    Rule                = Expression ENTAILS Expression\n    Statement           = ASSERT AtomList\n    Query               = QUERY ExpressionList\n\n    Expr                = XorExpr\n    XorExpr             = Expr XOR Expr\n                        | OrExpr\n    OrExpr              = Expr OR Expr\n                        | AndExpr\n    AndExpr             = Expr AND Expr\n                        | AtomExpr\n    NotExpr             = NOT AtomExpr\n                        | AtomExpr\n    AtomExpr            = LPAREN Expr RPAREN\n                        | Atom\n    Atom                = \u003cNAME\u003e\n\n    ExpressionList      | Expression LIST_SEPARATOR ExpressionList\n                        | AtomList\n                        | NULL\n    AtomList            = CompactAtomList\n                        | SeparatedAtomList\n    CompactAtomList     = \u003cNAME(len=1)\u003e CompactAtomList\n                        | NULL\n    SeparatedAtomList   = Atom LIST_SEPARATOR SeparatedAtomList\n                        | NULL\n\nterminals = {\n    \"NEWLINE\":          \"\\n\",\n    \"ENTAILS\":          \"=\u003e\",\n    \"ASSERT\":           \"=\",\n    \"QUERY\":            \"?\",\n    \"AND\":              \"+\",\n    \"OR\":               \"|\",\n    \"XOR\":              \"^\",\n    \"NOT\":              \"!\",\n    \"LIST_SEPARATOR\":   \",\",\n    \"LPAREN\":           \"(\",\n    \"RPAREN\":           \")\",\n}\n\n```\n\n## Algorithm and API\n\nA backward-chaining algorithm (with caching) is used to respond to queries.\n\nInputed rules are transformed into a data-flow graph, and queries are lazily-executed.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fthk2b%2Fexpert_system","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fthk2b%2Fexpert_system","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fthk2b%2Fexpert_system/lists"}