beyonddream / calculator

A simple parser written in python for evaluating expressions and sub-expressions consisting of arithmetic operations (`plus`, `minus`, `multiplication` and `division` and `parenthesis`) involving `int`.

Home Page:https://github.com/beyonddream/calculator

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

calculator

A simple parser written in python for evaluating expressions and sub-expressions consisting of arithmetic operations (plus, minus, multiplication and division and parenthesis) involving int.

Usage

$ python calculator.py
(3+4)*3/2
Evaluation of expression: (3+4)*3/2 is 10.5

Dependencies

  • python 3.9+
  • pip
  • poetry
  • hypothesis (to run property based test suite)
  • conda/venv for virtual environment creation and maintenance
# assuming virtual environment is activated from here onwards
$ pip install poetry
$ poetry install

Test

# To run simple unit test.

$ pytest tests/unit.py
# To run hypothesis (property based testing) suite.

$ pytest tests/property.py --hypothesis-show-statistics

About

A simple parser written in python for evaluating expressions and sub-expressions consisting of arithmetic operations (`plus`, `minus`, `multiplication` and `division` and `parenthesis`) involving `int`.

https://github.com/beyonddream/calculator

License:The Unlicense


Languages

Language:Python 100.0%