{"id":20358503,"url":"https://github.com/selfmadesystem/rpn-test","last_synced_at":"2026-05-29T21:31:20.786Z","repository":{"id":217375398,"uuid":"743723497","full_name":"SelfMadeSystem/rpn-test","owner":"SelfMadeSystem","description":"Reverse Polish Notation Calculator Test + infix to postfix converter","archived":false,"fork":false,"pushed_at":"2024-01-15T21:07:23.000Z","size":10,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-01-15T01:45:02.761Z","etag":null,"topics":["calculator","reverse-polish-calculator","reverse-polish-notation","rust"],"latest_commit_sha":null,"homepage":"","language":"Rust","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/SelfMadeSystem.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.md","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-01-15T21:05:13.000Z","updated_at":"2024-01-15T21:08:16.000Z","dependencies_parsed_at":null,"dependency_job_id":"1ed50cd0-b6f0-4a94-a692-70f48d6a0236","html_url":"https://github.com/SelfMadeSystem/rpn-test","commit_stats":null,"previous_names":["selfmadesystem/rpn-test"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/SelfMadeSystem%2Frpn-test","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/SelfMadeSystem%2Frpn-test/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/SelfMadeSystem%2Frpn-test/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/SelfMadeSystem%2Frpn-test/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/SelfMadeSystem","download_url":"https://codeload.github.com/SelfMadeSystem/rpn-test/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":241895424,"owners_count":20038512,"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":["calculator","reverse-polish-calculator","reverse-polish-notation","rust"],"created_at":"2024-11-14T23:27:17.434Z","updated_at":"2025-12-02T06:10:37.413Z","avatar_url":"https://github.com/SelfMadeSystem.png","language":"Rust","funding_links":[],"categories":[],"sub_categories":[],"readme":"# RPN Test\n\nThis is a simple RPN (Reverse Polish Notation) calculator that can be used to \nevaluate expressions in Reverse Polish Notation. Also includes an infix to \npostfix converter.\n\nIt uses the [Shunting-yard algorithm](https://en.wikipedia.org/wiki/Shunting-yard_algorithm) to convert infix to postfix.\n\n## Things I might add in the future\n\n- [ ] Compile to LLVM IR and generate an executable. That would be sick.\n\n## Usage\n\n\u003e Note: [rpn/infix] refers to the rpn or infix binary.\n\nThere are three ways to use this program:\n\n1. As a REPL (Read-Eval-Print-Loop) by running `cargo run --bin [rpn/infix]`.\n2. By passing arguments to the program, e.g. `cargo run --bin rpn 1 2 +`.\n\u003e Note: You can also use quotes to pass arguments, or even mix and match. For\n\u003e example, `cargo run --bin rpn 1 2 \"+ 3\" 4 +` is valid.\n3. By piping input to the program, e.g. `echo \"1 2 +\" | cargo run --bin [rpn/infix]`.\n\u003e Note: You can pipe multiple lines to the program, and it will evaluate each\n\u003e line separately. Any empty lines will be ignored and any errors will be\n\u003e printed to stderr.\n\n## Operators and values\n\n### Numbers\n\nNumbers are represented as floating point numbers.\n\nYou can represent a negative number by putting a `-` directly in front of it,\ne.g. `-1`.\n\n#### Operators\n\nThe following operators are supported for numbers:\n\n- `+` Addition\n- `-` Subtraction\n- `*` Multiplication\n- `/` Division\n- `^` Exponentiation\n- `sqrt` Square root (takes one argument)\n\nThe following return a boolean:\n\n- `=` Equality\n- `!=` Inequality\n- `\u003c` Less than\n- `\u003c=` Less than or equal to\n- `\u003e` Greater than\n- `\u003e=` Greater than or equal to\n\n### Booleans\n\nBooleans are represented as the strings `true` and `false`.\n\n#### Operators\n\nThe following operators are supported for booleans:\n\n- `=` Equality/Logical XNOR\n- `!=` Inequality/Logical XOR\n- `\u0026` Logical AND\n- `|` Logical OR\n- `!` Logical NOT (takes one argument)\n\n## Examples\n\n### RPN\n\nRPN (Reverse Polish Notation) is a postfix notation for mathematical expressions.\n\nNo parentheses are needed, or even supported, since the order of operations is\ndetermined by the order of the operands and operators.\n\nYou must include spaces between each operand and operator.\n\n```sh\n$ cargo run --bin rpn 1 2 +\n3\n$ cargo run --bin rpn \"1 2 + 3 *\" # put in quotes because * will be interpreted as a wildcard by the shell\n9\n$ cargo run --bin rpn \"1 2 + 3 * 4 / 5 - 6 7 * +\"\n39.25\n$ cargo run --bin rpn \"2 6 + 2 * sqrt 1.5 ^\"\n8\n$ cargo run --bin rpn \"2 6 + 8 =\"\ntrue\n$ cargo run --bin rpn \"true false \u0026\"\nfalse\n```\n\n### Infix\n\nInfix notation is the standard notation for mathematical expressions.\n\nParentheses are supported, and are used to determine the order of operations.\n\nSpaces aren't as required and will be automatically inserted, though my\ninsertion algorithm is not perfect.\n\n```sh\n$ cargo run --bin infix \"1 + 2\"\n3\n$ cargo run --bin infix \"1 + 2 * -3\"\n-5\n$ cargo run --bin infix \"1 + 2 * 3 - 4 / 5\"\n6.2\n$ cargo run --bin infix \"2 + (6 + 10) ^ 1.5\"\n66\n$ cargo run --bin infix \"sqrt(10 + 6)^1.5\"\n8\n$ cargo run --bin infix \"5 * 3 \u003c 4 * 4\"\ntrue\n$ cargo run --bin infix \"!((true \u0026 false) | true) != ! false\" # must put space between ! and false\ntrue\n```\n\n## License\n\nThis project is licensed under the MIT license. See the [LICENSE](LICENSE) file\nfor more details.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fselfmadesystem%2Frpn-test","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fselfmadesystem%2Frpn-test","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fselfmadesystem%2Frpn-test/lists"}