| Crates.io | arythemetic_expressions_parser_Kharchenko |
| lib.rs | arythemetic_expressions_parser_Kharchenko |
| version | 0.1.3 |
| created_at | 2025-11-05 19:47:59.765702+00 |
| updated_at | 2025-11-13 09:09:20.394972+00 |
| description | My own parser for Rust course in KMA that parses simple arythemetic expressions |
| homepage | |
| repository | |
| max_upload_size | |
| id | 1918504 |
| size | 23,783 |
this project implements a command-line parser for simple arithmetic expressions and handles expressions as such:
+, -, *, /((...))-x or expressions like -(1+2)log(x) for natural logarithm and sqrt(x) for square rootlog and sqrt): log(10 + 5), sqrt(2 + 7)((2 + 3) * 4)log is a natural logorythm (ln)the parser evaluates input expressions and returns the result
preprocessing:
-(...)expression evaluation:
* and / are evaluated first+ and - are evaluated afterwardsspecial functions:
log(x)):
x > 0, else -> errorln(x) using f64::ln()sqrt(x)):
x >= 0, else -> errorsqrt(x) using f64::sqrt()error handling:
log and sqrtParseError::InvalidExpression