Skip to content

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`.

License

beyonddream/calculator

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

23 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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`.

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages