{"id":22291928,"url":"https://github.com/nrmancuso/parseva-math","last_synced_at":"2026-02-22T18:37:01.907Z","repository":{"id":38312000,"uuid":"326464099","full_name":"nrmancuso/parseva-math","owner":"nrmancuso","description":"Compute mathematical expressions via abstract syntax tree.  Built with Java and ANTLR4.","archived":false,"fork":false,"pushed_at":"2023-03-27T10:59:19.000Z","size":239,"stargazers_count":2,"open_issues_count":11,"forks_count":1,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-08-01T01:31:07.827Z","etag":null,"topics":["antlr","antlr4","ast","calculation","grammar","java","math","parseva-math","parsing","syntax-tree"],"latest_commit_sha":null,"homepage":"","language":"Java","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"unlicense","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/nrmancuso.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,"zenodo":null}},"created_at":"2021-01-03T17:35:44.000Z","updated_at":"2025-03-12T02:13:43.000Z","dependencies_parsed_at":"2025-06-14T10:32:21.635Z","dependency_job_id":"a77e4c54-bdb0-4c89-b2ce-4da622ebc0b8","html_url":"https://github.com/nrmancuso/parseva-math","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/nrmancuso/parseva-math","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nrmancuso%2Fparseva-math","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nrmancuso%2Fparseva-math/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nrmancuso%2Fparseva-math/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nrmancuso%2Fparseva-math/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/nrmancuso","download_url":"https://codeload.github.com/nrmancuso/parseva-math/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nrmancuso%2Fparseva-math/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":29722025,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-02-22T15:10:41.462Z","status":"ssl_error","status_checked_at":"2026-02-22T15:10:04.636Z","response_time":110,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"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":["antlr","antlr4","ast","calculation","grammar","java","math","parseva-math","parsing","syntax-tree"],"created_at":"2024-12-03T17:18:55.424Z","updated_at":"2026-02-22T18:37:01.865Z","avatar_url":"https://github.com/nrmancuso.png","language":"Java","funding_links":[],"categories":[],"sub_categories":[],"readme":"![alt text](assets/logo_transparent.png)\n\u003ch1 align=\"center\"\u003e parseva-math \u003c/h1\u003e \u003cbr\u003e\n\u003ch4 align=\"center\"\u003e Compute and analyze expressions via abstract syntax tree. \u003c/h4\u003e\u003cbr\u003e  \n\u003chr/\u003e\n\n \u003ca href=\"https://github.com/nmancus1/parseva-math/graphs/contributors\"\u003e\n        \u003cimg src=\"https://img.shields.io/github/contributors/nmancus1/parseva-math\" /\u003e\u003c/a\u003e\n    \u003ca href=\"https://github.com/nmancus1/parseva-math/commits/main\"\u003e\n        \u003cimg src=\"https://img.shields.io/github/commit-activity/m/nmancus1/parseva-math\" /\u003e\u003c/a\u003e\n\n[![Quality Gate Status](https://sonarcloud.io/api/project_badges/measure?project=nmancus1_parseva-math\u0026metric=alert_status)](https://sonarcloud.io/summary/new_code?id=nmancus1_parseva-math)\n\n\n## Introduction\n\n**parseva-math** is a symbolic expression parsing tool, which can analyze and evaluate mathematical expressions. In a nutshell, parseva-math accepts a mathematical expression as a string, and first builds a heterogeneous abstract syntax tree of the expression. Then, **parseva-math** walks the tree to evaluate the expression.  Parseva-math also supports building a [homogeneous \nabstract syntax tree](https://github.com/nmancus1/parseva-math/blob/main/docs/HOMOGENEOUS_AST.md) and printing the result; this way expressions can be\nanalyzed for structure and correctness.\n\n## Getting Started\nYou will need to have a version of the JDK \u003e= 17 in order to build parseva-math.\u003cbr/\u003e\u003cbr/\u003e\nI plan to make a compiled jar once **parseva-math** reaches version 1.0.  Until then, you must\nclone this repository and build it yourself:\\\n`git clone https://github.com/nmancus1/parseva-math.git \u0026\u0026 cd parseva-math`\n\nThen, to build the jar:\\\n`mvn clean compile assembly:single`\n\nFinally, you can run **parseva-math**:\\\n`java -jar --enable-preview target/parseva-math-\u003cversion\u003e-SNAPSHOT-jar-with-dependencies.jar`\n\nNote that `--enable-preview` is required for now, since parseva-math uses JDK15 preview features.\n\n## Usage\n**parseva-math** has two different modes of operation; interactive and command line.  Mathematical\nfunctions, such as logarithmic and trigonometric functions are currently supplied by \n[java.lang.Math](https://docs.oracle.com/javase/8/docs/api/java/lang/Math.html).\n\u003cbr\u003e\n\u003cbr\u003e\n\n### **Interactive Mode**\nTo run **parseva-math** in the interactive mode, use `-i` or `--interact`:\n\n`java -jar --enable-preview target/parseva-math-\u003cversion\u003e-SNAPSHOT-jar-with-dependencies.jar -i`\n\nThis will drop you into the parseva-math terminal, where you can evaluate expressions:\n```\n\u003e 2 + 2\n= 4.000000\n\n\u003e sin(1)\n= 0.841471\n\n\u003e sqrt(sin(0) + 20 + sqrt(50 - pow(5, 2)))\n= 5.000000\n```\n\nTo exit, simply press enter at an empty prompt.\n\u003cbr\u003e\n\u003cbr\u003e\n\n### **Evaluate via Command Line**\n\nTo evaluate one expression via command line, use `-e \"\u003cexpression\u003e\"` or \n`--evaluate \"\u003cexpression\u003e\"`:\n```bash\n ➜  java -jar --enable-preview target/parseva-math-\u003cversion\u003e-SNAPSHOT-jar-with-dependencies.jar -e \"atan(0.5)\"\n = 0.463648\n```\n**parseva-math** also supports the constants `pi` and `e`.\n\u003cbr\u003e\n\u003cbr\u003e\n\n### **Print Expression Tree**\nUsing the `-t \u003cexpression\u003e` or `--tree \u003cexpression\u003e` allows users to tell parseva-math to construct a [homogeneous abstract syntax tree](https://github.com/nmancus1/parseva-math/blob/main/docs/HOMOGENEOUS_AST.md) using [MathAstNodes](https://github.com/nmancus1/parseva-math/blob/main/src/main/java/parsevamath/tools/MathAstNode.java), then walk the tree and print the results.   \n\n Example:\n\n```bash\n➜  java -jar --enable-preview target/parseva-math-0.1-SNAPSHOT-jar-with-dependencies.jar -t \"sin(sqrt(2.2) + pow(0.5,0.5))\"\n'- FUNCTION -\u003e sin\n   |- LPAREN -\u003e (\n   |- OP_ADD -\u003e +\n   |  |- FUNCTION -\u003e sqrt\n   |  |  |- LPAREN -\u003e (\n   |  |  |- NUM -\u003e 2.2\n   |  |  '- RPAREN -\u003e )\n   |  '- FUNCTION -\u003e pow\n   |     |- LPAREN -\u003e (\n   |     |- NUM -\u003e 0.5\n   |     |- COMMA -\u003e ,\n   |     |- NUM -\u003e 0.5\n   |     '- RPAREN -\u003e )\n   '- RPAREN -\u003e )\n\n```\n\n### **Help**\n\nUsage help is available using `-h`, `--help`, or simply providing no arguments to **parseva-math**.\n\n## Contributing\n\nIf you'd like to contribute, start by searching through the \n[issues](https://github.com/nmancus1/parseva-math/issues)\nand [pull requests](https://github.com/nmancus1/parseva-math/pulls) to see whether someone else has\nraised a similar idea or question.\n\nIf you don't see your idea listed, and you think it fits into the goals of this guide, start by opening \nan issue first. That way, other people can weigh in on the discussion before you do any work.\n  \n#### Contribution Workflow\n\n1. **Fork** this repo on GitHub\n2. **Clone** the project to your own machine from YOUR fork on github. `git clone \"url from your fork\"` then change into\n   the new directory.\n3. **Set Upstream** do `git remote add upstream https://github.com/nmancus1/parseva-math.git`\n4. **Make new branch** for YOUR code submission; do `git checkout -b \n   \u003cwhatever you want to name this branch\u003e`\n4. **Commit** changes to your *new* branch, with descriptive message\n5. **Run** `mvn clean verify` ; make sure this passes before pushing your changes.\n5. **Push** your work back up to your fork `git push origin \u003cyour branch name\u003e`\n6. **On Github** Submit a **Pull request** so that your changes can be reviewed\n\nNOTE: Be sure to merge the latest from \"upstream\" before making a pull request!\nAll conflicts should be handled locally, then rebased and pushed to github.\n\nTo sync your `main` branch before starting to code, do:\n\n1. `git checkout main`\n2. `git fetch --all`\n3. `git pull upstream main`\n4. `git push` - this syncs your fork on github.\n5. Start on #4 above to begin a new contribution.\n\n[Here is a great cheatsheet for git/github.](https://education.github.com/git-cheat-sheet-education.pdf) \u003cbr/\u003e\n[Here is another article that describes this exact workflow, in more detail.](https://blog.scottlowe.org/2015/01/27/using-fork-branch-git-workflow/)\n\n#### Ground rules \u0026 expectations\n\nBefore we get started, here are a few things we expect from you (and that you should expect from others):\n\n* Be kind and thoughtful in your conversations around this project. We all come from different backgrounds and projects,\n  which means we likely have different perspectives on \"how open source is done.\" Try to listen to others rather than\n  convince them that your way is correct.\n* If you open a pull request, please ensure that your contribution passes all tests. If there are test failures, you\n  will need to address them before we can merge your contribution.\n  \n## Phases\n\nTo generate Jacoco report, do:\n`mvn clean verify`\n\nThe report will be generated in `target/site/jacoco`.\n\n## License\nDistributed under the [Unlicense](https://unlicense.org/). \n\n## Built With\n* [ANTLR4](https://github.com/antlr/antlr4)\n* [OpenJDK17](https://openjdk.java.net/projects/jdk/17/)\n* [Maven](https://maven.apache.org/)\n* [picocli](https://picocli.info/)\n\n## Acknowledgements\n* [Checkstyle](https://github.com/checkstyle/checkstyle)\n* [Lucas Trzesniewski](https://github.com/ltrzesniewski)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnrmancuso%2Fparseva-math","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fnrmancuso%2Fparseva-math","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnrmancuso%2Fparseva-math/lists"}