{"id":19645416,"url":"https://github.com/corani/bantamgo","last_synced_at":"2026-05-15T02:49:29.546Z","repository":{"id":248632269,"uuid":"829246484","full_name":"corani/bantamgo","owner":"corani","description":null,"archived":false,"fork":false,"pushed_at":"2024-09-05T09:48:36.000Z","size":28,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-01-09T20:48:24.106Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Go","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/corani.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":"2024-07-16T04:02:11.000Z","updated_at":"2024-09-05T09:48:41.000Z","dependencies_parsed_at":"2024-11-11T14:36:41.203Z","dependency_job_id":"90af898b-44b9-40a3-bfb3-cec5b6ffe3ca","html_url":"https://github.com/corani/bantamgo","commit_stats":null,"previous_names":["corani/bantamgo"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/corani%2Fbantamgo","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/corani%2Fbantamgo/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/corani%2Fbantamgo/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/corani%2Fbantamgo/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/corani","download_url":"https://codeload.github.com/corani/bantamgo/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":240952975,"owners_count":19884020,"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-11-11T14:33:55.025Z","updated_at":"2026-05-15T02:49:24.509Z","avatar_url":"https://github.com/corani.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# BantamGo\n\nA Go implementation of the Pratt parser for the Bantam language. Based on the excellent \n[Pratt parsers: Expression parsing made easy](https://journal.stuffwithstuff.com/2011/03/19/pratt-parsers-expression-parsing-made-easy/)\nblog post by Bob Nystrom.\n\nI've taken the liberty to add (floating point) numbers, change the parselets from classes to \nfunctions and extracted the \"Print\" function for the Expression using the Visitor pattern.\n\n## Update 1\n\nAdded support for parsing blocks of statements so you can do things like: \n\n```\nPI = 3.14159265358979323846;\nE = 2.71828182845904523536;\npow(PI, 2) + pow(E, 2);\n```\n\nNote: `pow` was added as a built-in function, as it's not (yet) possible to create user-defined\nfunctions.\n\nMoreover, I've added a simple evaluator for the expressions, so you can actually run the code.\n\nExample: \n\n```bash\n$ go run . \"PI=3.1415; E=2.7182; pow(PI, 2) + pow(E, 2)\"\n2024/09/05 17:35:15 input: PI=3.1415; E=2.7182; pow(PI, 2) + pow(E, 2)\n2024/09/05 17:35:15 parsed: (PI = 3.1415); (E = 2.7182); (pow(PI, 2) + pow(E, 2))\n2024/09/05 17:35:15 s-expr: (block (write 'PI' (number 3.1415)) (write 'E' (number 2.7182)) (+ (call (read 'pow') (read 'PI') (number 2) ) (call (read 'pow') (read 'E') (number 2) )) )\n2024/09/05 17:35:15 tree:\nblock\n  assign\n    name 'PI'\n    number 3.1415\n  assign\n    name 'E'\n    number 2.7182\n  infix '+'\n    call\n      name 'pow'\n      name 'PI'\n      number 2\n    call\n      name 'pow'\n      name 'E'\n      number 2\n2024/09/05 17:35:15 answer: 17.25763349\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcorani%2Fbantamgo","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcorani%2Fbantamgo","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcorani%2Fbantamgo/lists"}