A basic python REPL application to calculate simple mathematical equation
The App is divided into:
- The
main
interface - The
Validator
, to validate the inputs - The
Tokenizer
, to transform validated inputs into list of tokens - The
Calculator
, to calculate tokenize equation into digit - The
Command
, to call the built in commands from inputs - The
Exception
, to represent custom errors - The
Variable
to represent a variable - The
Digit
to represent the numeric operands - The
Operator
to represent the Operator - The
Memory
to represent as a store for numeric value ofVariable
- Store and use variables in your equation!
- Parenthesis, Multiplication, Division, Exponentiation, Addition, Subtraction and Assignment!
- Stuck? use help! (/help)
python calculator/calculator.py
> 8 * 3 + 12 * (4 - 2)
48
> 2 - 2 + 3
3
> 4 * (2 + 3
Invalid expression
> -10
-10
> a=4
> b=5
> c=6
> a*2+b*3+c*(2+3)
53
> 1 +++ 2 * 3 -- 4
11
> 3 *** 5
Invalid expression
> 4+3)
Invalid expression
> /command
Unknown command
> /exit
Bye!
Tested to work and run properly on python 3.8.5