saiwolf / rpn-rs

RPN Calculator In Rust

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

RPN Calculator In Rust!

This is a program that parses a RPN Notation Equation and prints the result. Based off of rpn.py by @wd5gnr.

Heads Up!

This is a POC! Features may be added or removed as seen fit.

LICENSE

See the LICENSE file. TLDR - MIT License

Usage

Usage: rpn_calculator.exe [OPTIONS]

Options:
  -e, --expression <EXPRESSION>  Reverse Polish Notation Equation
  -t, --test-info                Show some test info and exit.
  -h, --help                     Print help
  -V, --version                  Print version

Building

Use cargo build to build the source.

cd <Checkout directory>
cargo run -- --expression "2 8 +"

Valid Operators

As of 02/23/2024, rpn-rs understands the following operators:

Operator Description
+ Addition
- Subtraction
* Multiplication
/ Division
^ Power Of
! Store Top Of Stack in a tempVar
@ Retrieve tempVar and push to Top Of Stack
? Dump the stack
& Dump the tempVar list

About

RPN Calculator In Rust

License:MIT License


Languages

Language:Rust 100.0%