A basic arithmetic calculator implemented in Ruby
- Lexer (converts input string to array of tokens)
- Parser (converts array of tokens to RPN)
- Evaluator (evaluates RPN expression)
+
(addition)-
(subtraction)/
(division)*
(multiplication)^
(exponentiation)log
(taking the logarithm)
ruby app.rb [expression]
ruby app.rb "log 100 10 * ((4 - 7) ^ (3 + 1) / 4)"