{"id":26756917,"url":"https://github.com/firedragon91245/boolean-algebra-evaluator","last_synced_at":"2025-10-29T16:19:02.977Z","repository":{"id":284044288,"uuid":"953641166","full_name":"FireDragon91245/boolean-algebra-evaluator","owner":"FireDragon91245","description":"A simple rust programm to interpret boolean algebra expressions using a Tokenizer \u0026 Recursive Decent AST building","archived":false,"fork":false,"pushed_at":"2025-03-23T21:20:15.000Z","size":7,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-03-23T21:26:51.574Z","etag":null,"topics":["boolean-algebra","evaluator","rust","truth-table-generator"],"latest_commit_sha":null,"homepage":"","language":"Rust","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/FireDragon91245.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":"2025-03-23T20:14:21.000Z","updated_at":"2025-03-23T21:20:17.000Z","dependencies_parsed_at":"2025-03-23T21:27:27.158Z","dependency_job_id":"85644ec1-dcf6-43cd-a434-847c22a0f434","html_url":"https://github.com/FireDragon91245/boolean-algebra-evaluator","commit_stats":null,"previous_names":["firedragon91245/boolean-algebra-evaluator"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/FireDragon91245%2Fboolean-algebra-evaluator","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/FireDragon91245%2Fboolean-algebra-evaluator/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/FireDragon91245%2Fboolean-algebra-evaluator/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/FireDragon91245%2Fboolean-algebra-evaluator/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/FireDragon91245","download_url":"https://codeload.github.com/FireDragon91245/boolean-algebra-evaluator/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":246049675,"owners_count":20715513,"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":["boolean-algebra","evaluator","rust","truth-table-generator"],"created_at":"2025-03-28T15:21:53.149Z","updated_at":"2025-10-29T16:19:02.969Z","avatar_url":"https://github.com/FireDragon91245.png","language":"Rust","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Boolean algebra evaluator\nJust a simple evaluator/interpretter based on an AST\n\n# Build\n- just clone the repo\n- `cd` there\n- `cargo build`\n\n# Syntax\n\u003e [!IMPORTANT]\n\u003e All characters in an expression must be lower case\n### Operators\n\u003e| Operator | Character |\n\u003e|----------|-----------|\n\u003e| AND      | \u0026         |\n\u003e| OR       | \\|        |\n\u003e| NOT      | !         |\n\u003e| XOR      | ^         |\n### Literals\n\u003e| Literal | Value |\n\u003e|---------|-------|\n\u003e| true    | true  |\n\u003e| 1       | true  |\n\u003e| false   | false |\n\u003e| 0       | false |\n### Groups\n- Any expression can be wrapped in `(...)` to make a group\n### Identifiers\n- `a-z` are identifiers if they are not part of a literal\n- each identifier can be true or false\n- identifiers are placeholders that get a value during evaluation\n- they resemble the state of an hypotetical bus\n- the evaluator handles them not strictly so if you use `a\u0026c\u0026e\u0026` `a` will be the first bit, `c` the second and `e` the third so there will overall be still only `7` variants not a..e (1-5) `63` variants\n- during truth table generation each identifier combination gets evaluated\n\n# Operator Prioritys\n| Priority | Operator  | Symbol(s)                               |\n|----------|-----------|-----------------------------------------|\n| Highest  | NOT       | ¬, ̄, !                                  |\n|          | AND       | ∧, ·                                   |\n|          | OR        | ∨, +                                   |\n|          | XOR       | ⊕, ⊻                                   |\n| Lowest   | EQUALS    | =, ≡, ↔, ⇔                             |\n\n# Usage\n#### booleval --help\n\u003e Prints the help\n#### booleval [expression]\n\u003e Evaluates a pure bool expression, no identifiers, for example \"true^false\" \n#### booleval -T [expression] {-t -f}\n\u003e Evaluates all posible combinations of expression and prints it as a truth table  \n\u003e You can optionally add a `-f` XOR `-t` flags to filter for `-f=false`, `-t=true` results only\n```bash\n\u003e .\\booleval -T \"a^b\"\n╭───────┬───────┬────────╮\n│ b     │ a     │ Result │\n├───────┼───────┼────────┤\n│ false │ false │ false  │\n│ false │ true  │ true   │\n│ true  │ false │ true   │\n│ true  │ true  │ false  │\n╰───────┴───────┴────────╯\n```\n#### booleval -t [...args] [expression]\n\u003e Evaluates the specefied expression with a specified identifier state\n```bash\n\u003e booleval -t 111 \"a\u0026b\u0026c\"\ntrue\n# ...args = binary string each bit mapping to 1 identifier (a = 1, b = 1, c = 1) = 111\n\n\u003e booleval -t 7 \"a\u0026b\u0026c\"\ntrue\n# ...args = numeric string each bit mapping to 1 identifier (a = 1, b = 1, c = 1) = 111 = 7\n\n\u003e booleval -t true true true \"a\u0026b\u0026c\"\n#OR\n\u003e booleval -t 1 1 1 \"a\u0026b\u0026c\"\ntrue\n# ...args = boolean string each mapping to 1 bit (a = 1, b = 1, c = 1) = true true true or 1 1 1\n```\n#### booleval -a [expression] {-p, -e}\n\u003e Prints the ast for the boolean expression, identifiers are allowed\n```bash\n# Default\n\u003e booleval -a \"a|b\"\n    |\n   / \\\n  /   \\\n /     \\\na       b\n\n# Pretty\n\u003e booleval -a \"a|b\" -p\n |\n┌┴┐\na b\n\n# Extended\n\u003e booleval -a \"a|b\" -e\n   OR\n   / \\\n  /   \\\n /     \\\na       b\n\n# Extended \u0026 Pretty\n\u003e booleval -a \"a|b\" -ep\nOR\n┌┴┐\na b\n```\n\u003e More Complex example: 2-4 Muliplexer `\"(!a \u0026 !b \u0026 c) | (!a \u0026 b \u0026 d) | (a \u0026 !b \u0026 e) | (a \u0026 b \u0026 f)\"`\n\u003e where a \u0026 b are the selector bits and c, d, e and f are the value bits\n```bash\n\u003e booleval -a \"(!a \u0026 !b \u0026 c) | (!a \u0026 b \u0026 d) | (a \u0026 !b \u0026 e) | (a \u0026 b \u0026 f)\" -pe\n                    OR\n               ┌─────┴──────┐\n              OR           GRP\n         ┌─────┴─────┐      │\n        OR          GRP    AND\n     ┌───┴────┐      │     ┌┴─┐\n    GRP      GRP    AND   AND f\n     │        │    ┌─┴──┐ ┌┴┐\n    AND      AND  AND   e a b\n  ┌──┴──┐   ┌─┴─┐ ┌┴┐\n AND    c  AND  d a NOT\n┌─┴─┐     ┌─┴─┐     │\nNOT NOT   NOT b     b\n│   │     │\na   b     a\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffiredragon91245%2Fboolean-algebra-evaluator","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ffiredragon91245%2Fboolean-algebra-evaluator","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffiredragon91245%2Fboolean-algebra-evaluator/lists"}