A calculator based on Python's list
-like stack.
- Make sure
python==3.8
is installed on your computer. - Run
/path/to/python app.py
in root folder of project. - Enter arguments as needed.
No need to install! Just use it!
If you have to install it, just run sh install.sh
(or make install
). It will copy all .py
files to ~/.local/lib/python3.8/site-packages/ctack-calc
. Use sh uninstall.sh
(or make uninstall
) to uninstall.
app.py
: The main application.argparsing.py
: The argument parsing module meant to be imported byapp.py
to parse command-line arguments.by_operands.py
: The module that seperatesSOperator
intoNoOperand
,SingleOperand
, andDoubleOperand
.convert.py
: The module that converts between postfix and infix expressions.exceptions.py
: The module that definesInputError
for the calculator.new_operator.py
: The module that defines functionnew_operator
for creating an operator.soperator.py
: The module that defines classSOperator
that represents a stack operator. (Pretty cool name, huh?)stack.py
: The module that defines classStack
that imitates a stack that is powered by alist
.utils.py
: The module that defines some utilities used in the application.
A post-fix expression is an expression in which the operator follows the operands. This is in contrast to an in-fix expression, where the operator is between the operands. This calculator supports both types - just pass -i/--infix
for infix notation, and -p/--postfix
for postfix notation. The default is postfix.
I welcome contributors, if there are any 😄 If you wish to contribute, simply clone this repository, add any code you wish, and then open a pull request. (I really need more operators...)