compiler-calc-0.0.1rc4
توضیحات
A simple calculator programme
| ویژگی | مقدار |
|---|---|
| سیستم عامل | OS Independent |
| نام فایل | compiler-calc-0.0.1rc4 |
| نام | compiler-calc |
| نسخه کتابخانه | 0.0.1rc4 |
| نگهدارنده | [] |
| ایمیل نگهدارنده | [] |
| نویسنده | Bo HAN |
| ایمیل نویسنده | bohan.academic@gmail.com |
| آدرس صفحه اصلی | https://github.com/tq010or/compiler_calc |
| آدرس اینترنتی | https://pypi.org/project/compiler-calc/ |
| مجوز | - |
# A simple calculator
This is a simple calculator when I try to recall my compiler courses.
## Installation
Use the package manager [pip](https://pip.pypa.io/en/stable/) to install compiler-calc.
```bash
pip install compiler-calc
```
## Usage
```python
from compiler_calc.simple_calc import LexAnalysis, SyntaxAnalysis
# To highlight lexcial and syntax analysis
lex_analyser = LexAnalysis()
syntax_analyser = SyntaxAnalysis()
# You can define your own helper functions
def calculate(expr, lex=lex_analyser, syn=syntax_analyser):
expr_list = lex(expr)
return syn(expr_list)
calculate('5+4*3^2') # 41
calculate('1/0') # ValueError
```
## Contributing
Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change.
Please make sure to update tests as appropriate.
## License
[MIT](https://choosealicense.com/licenses/mit/)
زبان مورد نیاز
| مقدار | نام |
|---|---|
| >=3.7 | Python |
نحوه نصب
نصب پکیج whl compiler-calc-0.0.1rc4:
pip install compiler-calc-0.0.1rc4.whl
نصب پکیج tar.gz compiler-calc-0.0.1rc4:
pip install compiler-calc-0.0.1rc4.tar.gz