{"id":22696156,"url":"https://github.com/zdimension/simplecalc","last_synced_at":"2025-03-29T18:11:37.805Z","repository":{"id":97140941,"uuid":"275543435","full_name":"zdimension/simplecalc","owner":"zdimension","description":"Simple formula parser and evaluator","archived":false,"fork":false,"pushed_at":"2020-06-28T08:50:22.000Z","size":5,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-02-04T18:52:13.777Z","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":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/zdimension.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}},"created_at":"2020-06-28T08:43:15.000Z","updated_at":"2020-06-28T08:50:24.000Z","dependencies_parsed_at":null,"dependency_job_id":"1adfb88e-efc2-4149-8556-4ce782e08c94","html_url":"https://github.com/zdimension/simplecalc","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zdimension%2Fsimplecalc","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zdimension%2Fsimplecalc/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zdimension%2Fsimplecalc/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zdimension%2Fsimplecalc/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/zdimension","download_url":"https://codeload.github.com/zdimension/simplecalc/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":246223331,"owners_count":20743167,"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":[],"created_at":"2024-12-10T04:14:29.591Z","updated_at":"2025-03-29T18:11:37.799Z","avatar_url":"https://github.com/zdimension.png","language":"Python","readme":"# simplecalc\nSimple formula parser and evaluator\n\n## Requirements\n\nRequires Python 3.7 (probably)\n\n## Usage\n\nRuns as an interactive REPL.\n\nDisplays the stringified AST, the beautified expression and either the result or the detailed error.\n\n```\n$ python3 calc.py\n\u003e 2+2\nparse.\u003clocals\u003e.BinOpNode(pos=1, op=BinOperator(symbol='+', priority=0, perform=\u003cbuilt-in function add\u003e, rtl=False), left=parse.\u003clocals\u003e.NumberNode(pos=0, val=2), right=parse.\u003clocals\u003e.NumberNode(pos=2, val=2))\n(2 + 2)\n4\n\n\u003e 2^2^2\nparse.\u003clocals\u003e.BinOpNode(pos=1, op=BinOperator(symbol='^', priority=2, perform=\u003cbuilt-in function pow\u003e, rtl=True), left=parse.\u003clocals\u003e.NumberNode(pos=0, val=2), right=parse.\u003clocals\u003e.BinOpNode(pos=3, op=BinOperator(symbol='^', priority=2, perform=\u003cbuilt-in function pow\u003e, rtl=True), left=parse.\u003clocals\u003e.NumberNode(pos=2, val=2), right=parse.\u003clocals\u003e.NumberNode(pos=4, val=2)))\n(2 ^ (2 ^ 2))\n16\n\n\u003e 2+2+2\nparse.\u003clocals\u003e.BinOpNode(pos=3, op=BinOperator(symbol='+', priority=0, perform=\u003cbuilt-in function add\u003e, rtl=False), left=parse.\u003clocals\u003e.BinOpNode(pos=1, op=BinOperator(symbol='+', priority=0, perform=\u003cbuilt-in function add\u003e, rtl=False), left=parse.\u003clocals\u003e.NumberNode(pos=0, val=2), right=parse.\u003clocals\u003e.NumberNode(pos=2, val=2)), right=parse.\u003clocals\u003e.NumberNode(pos=4, val=2))\n((2 + 2) + 2)\n6\n\n\u003e 2+2+\n      ↑\nexpected token, got EOL at 4\n```\n\n## Supported operators / functions\n\nUnary:\n- `-` : negation\n- `~` : binary complement\n\nBinary:\n- `+` : sum\n- `-` : difference\n- `*` : product\n- `/` : quotient\n- `^` : exponent (right-to-left associative)\n\nFunctions:\n- everything from `cmath`\n- everything from `math` that isn't in `cmath` (`cos` is `cmath.cos` and not `math.cos`)\n\nConstants:\n- everything from `cmath` or `math`\n- `i` : imaginary unit\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fzdimension%2Fsimplecalc","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fzdimension%2Fsimplecalc","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fzdimension%2Fsimplecalc/lists"}