Learning the Rust programming language
This repository is dedicated to exploring and practicing Rust through small projects.
The first project is a simple calculator.
It consists of three main stages:
- Tokenization β the calculator parses a math expression into tokens (numbers, operators, brackets, etc.).
- Math expession parse - Analyzes and transform a sequence of tokens.
- Conversion to Reverse Polish Notation (RPN) β using the Shunting Yard algorithm.
- Evaluation β the calculator evaluates the expression in RPN form.
β Features:
- Supports basic operators:
+,-,*,/ - Handles parentheses
- Parses floating-point numbers
βοΈ Example:
let expression = "(12.5 + 3) * 2";
let result = calculator::evaluate(expression).unwrap();
println!("Result: {}", result); // Output: 31.0