{"id":30288423,"url":"https://github.com/4ster-light/py-logic","last_synced_at":"2025-08-16T22:36:58.548Z","repository":{"id":308379619,"uuid":"1032471183","full_name":"4ster-light/py-logic","owner":"4ster-light","description":"Implementation of a logic formula parser and truth table generator in Python.","archived":false,"fork":false,"pushed_at":"2025-08-13T10:59:05.000Z","size":11,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2025-08-13T12:39:24.817Z","etag":null,"topics":["interpreter","lexer","parser","python"],"latest_commit_sha":null,"homepage":"https://aster.deno.dev/posts/introduction-to-interpreters-part-1","language":"Python","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/4ster-light.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":".github/FUNDING.yml","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},"funding":{"github":null,"patreon":null,"open_collective":null,"ko_fi":"4ster","tidelift":null,"community_bridge":null,"liberapay":null,"issuehunt":null,"lfx_crowdfunding":null,"polar":null,"buy_me_a_coffee":null,"thanks_dev":null,"custom":null}},"created_at":"2025-08-05T11:00:08.000Z","updated_at":"2025-08-13T10:59:08.000Z","dependencies_parsed_at":"2025-08-05T17:25:45.452Z","dependency_job_id":null,"html_url":"https://github.com/4ster-light/py-logic","commit_stats":null,"previous_names":["4ster-light/py-logic"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/4ster-light/py-logic","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/4ster-light%2Fpy-logic","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/4ster-light%2Fpy-logic/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/4ster-light%2Fpy-logic/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/4ster-light%2Fpy-logic/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/4ster-light","download_url":"https://codeload.github.com/4ster-light/py-logic/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/4ster-light%2Fpy-logic/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":270781209,"owners_count":24643807,"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-08-16T02:00:11.002Z","response_time":91,"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":["interpreter","lexer","parser","python"],"created_at":"2025-08-16T22:36:56.686Z","updated_at":"2025-08-16T22:36:58.536Z","avatar_url":"https://github.com/4ster-light.png","language":"Python","funding_links":["https://ko-fi.com/4ster","https://ko-fi.com/B0B41HVJUR"],"categories":[],"sub_categories":[],"readme":"# 🐍 py-logic\n\nImplementation of a logic formula parser and truth table generator in Python.\n\n## 📚 Table of Contents\n\n- [📜 Overview](#-overview)\n- [🛠 Usage](#-usage)\n- [📋 Requirements](#-requirements)\n- [📄 License](#-license)\n- [💝 Sponsor](#-sponsor)\n\n## 📜 Overview\n\nThis project is meant as educational material in order to learn about basic\ninterpreters and the process of lexing and parsing a language as well as the\nconcept of AST (Abstract Syntax Tree), therefore why it supports only basic\nlogic symbols.\n\nThe choice of interpreting logic formulas was made due to its relative\nsimplicity and the fact that it is related to computer science.\n\nThat is also the same reason the tutorial is written in Python, as it is a\npopular language for beginners and it is easy to understand, you can find the\nwhole blog post\n[here](https://aster.deno.dev/posts/introduction-to-interpreters/).\n\n## 🛠 Usage\n\n- Run `python main.py` to generate a truth table for a given formula:\n\n```bash\n$ python main.py\nEnter a logical formula (e.g., P \u0026 Q -\u003e R, !A | B):\n\nP \u0026 Q -\u003e R\n\nP | Q | R | P \u0026 Q -\u003e R\n----------------------\nT | T | T | T\nT | T | F | F\nT | F | T | T\nT | F | F | T\nF | T | T | T\nF | T | F | T\nF | F | T | T\nF | F | F | T\n```\n\n- Run `python main.py --debug` to see the tokens and expression tree generated\n  by the parser:\n\n```bash\n$ python main.py --debug\n\nEnter a logical formula (e.g., P \u0026 Q -\u003e R, !A | B):\n\nP \u0026 Q -\u003e R\n\n- Formula:\n  - P \u0026 Q -\u003e R\n- Tokens:\n  - Token(type='Variable', lexeme='P')\n  - Token(type='AndOp', lexeme='\u0026')\n  - Token(type='Variable', lexeme='Q')\n  - Token(type='ImpliesOp', lexeme='-\u003e')\n  - Token(type='Variable', lexeme='R')\n  - Token(type='Eof', lexeme=None)\n- Expression:\n  - Implies(left=And(left=Var(name='P'), right=Var(name='Q')), right=Var(name='R'))\n```\n\n## 📋 Requirements\n\nOnly Python 3 or higher is required.\n\n## 📄 License\n\nThis project is licensed under the MIT License - see the [LICENSE](LICENSE) file\nfor details.\n\n## 💝 Sponsor\n\nIf you like this project, consider supporting me by buying me a coffee.\n\n[![ko-fi](https://ko-fi.com/img/githubbutton_sm.svg)](https://ko-fi.com/B0B41HVJUR)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2F4ster-light%2Fpy-logic","html_url":"https://awesome.ecosyste.ms/projects/github.com%2F4ster-light%2Fpy-logic","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2F4ster-light%2Fpy-logic/lists"}