{"id":17124073,"url":"https://github.com/jayu/arithmetic-parser","last_synced_at":"2025-03-24T03:16:43.827Z","repository":{"id":118314982,"uuid":"242510988","full_name":"jayu/arithmetic-parser","owner":"jayu","description":null,"archived":false,"fork":false,"pushed_at":"2020-06-10T16:57:36.000Z","size":5,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-03-18T05:12:27.295Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"JavaScript","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/jayu.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":"2020-02-23T12:15:54.000Z","updated_at":"2020-06-10T16:57:42.000Z","dependencies_parsed_at":null,"dependency_job_id":"d7c713ee-ca65-4163-8fff-df982c7b220d","html_url":"https://github.com/jayu/arithmetic-parser","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/jayu%2Farithmetic-parser","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jayu%2Farithmetic-parser/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jayu%2Farithmetic-parser/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jayu%2Farithmetic-parser/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/jayu","download_url":"https://codeload.github.com/jayu/arithmetic-parser/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":245200706,"owners_count":20576674,"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-10-14T18:41:48.334Z","updated_at":"2025-03-24T03:16:42.899Z","avatar_url":"https://github.com/jayu.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Arithmetic parser\n\nThe goal of this project was to train some regular expressions and create parser for arithmetic expressions.\nInitially I wanted to create simple programing language, but I wanted to start with something easy.\nAfter I managed to implement this parser, I started looking on how parsers and compilers are build.\nIt turned out that building programming language parser just with regexps is not a the best idea due to low maintainability and issues with nested recursive expressions. I decided to give up on further development of this parser, and hopefully starting a new project of simple programing language parser.\nHowever I think the work that was done here was quite successful. My parser can:\n\n- parse expressions with subtraction, addition, multiplication, division and parenthesis.\n- compile equation to three languages: JavaScript, Python and Rust.\n\nOf course, any of the languages can execute this kind of equation just as it is, but I wanted to check how actually code is interpreted by the machine, without looking on any tutorials at first.\n\n## Example\n\n```sh\nnode index.js (1+3)/4+7-1*2\n```\n\nwill output \"compiled\" source code, and print the result.\n\n```sh\nCode\n_____\nconst i7 = 1.0 + 3.0;\nconst i3 = i7 / 4.0;\nconst i1 = i3 + 7.0;\nconst i2 = 1.0 * 2.0;\nconst i0 = i1 - i2;\nconsole.log(i0)\n_____\nResult\n6\n```\n\n## Missing features\n\n- unary operators for negative numbers (be able to parse `-5`)\n- power operator (`3^2`, `2^2^2`)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjayu%2Farithmetic-parser","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjayu%2Farithmetic-parser","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjayu%2Farithmetic-parser/lists"}