Calculadore is a calculator written in Rust, developed for learning purposes. It uses Reverse Polish Notation to perform calculations respecting the order of operations and priorities.
- Operations Already Supported: Addition (+), Subtraction (-), Multiplication (*), Division (/) and Exponentiation (^).
- Parentheses: Support for the use of parentheses to define the order of operations.
-
Clone the Repository:
git clone https://github.com/CoininDev/calculadore.git cd calculadore
-
Compile the Project:
cargo build
NOTE: You need to install Rust to compile the project.
-
Run the Calculator:
cargo run
-
Enter a Mathematical Expression:
- Examples:
2+3*4
,(1+2)^3
- To exit, type
exit
.
- Examples:
- Tokenization: The
tokenize
function converts a string of mathematical expression into a list of tokens. - Shunting Yard: The
shunting_yard
function converts the list of tokens to reverse polish notation (RPN). - Evaluation: The
evaluate
function calculates the value of the expression in RPN.
Contributions are welcome! Feel free to open issues and pull requests.