Metadata-Version: 2.4
Name: meth
Version: 2.0.0
Summary: A mathematical expression parser and evaluator.
Project-URL: Homepage, https://github.com/sertdfyguhi/meth
Project-URL: Bug Tracker, https://github.com/sertdfyguhi/meth/issues
Author: sertdfyguhi
License-File: LICENSE
Keywords: evaluator,math,math evaluator,math parser,mathematical,parser,parsing
Classifier: Development Status :: 4 - Beta
Classifier: License :: OSI Approved :: GNU General Public License v3 (GPLv3)
Classifier: Operating System :: OS Independent
Classifier: Programming Language :: Python
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.11
Classifier: Topic :: Scientific/Engineering :: Mathematics
Requires-Python: >=3.0
Description-Content-Type: text/markdown

# meth: A mathematical expression parser.

A python package to parse and evaluate mathematical expressions.

# Installation

```sh
pip install meth
```

or install it from source:

```sh
git clone https://github.com/sertdfyguhi/meth/
cd meth
python3 -m build
pip install dist/*.whl
```

# Examples

> _More examples in the [examples/](https://github.com/sertdfyguhi/meth/tree/master/examples) directory._

```py
import meth

# tokenizing equations
tokens = meth.tokenize("5 + 2") # Token(NUMBER, 5), Token(+), Token(NUMBER, 2)

# parsing equations
ast = meth.parse(tokens) # BinaryOp(Number(5), +, Number(2))

# evaluating equations
meth.evaluate("2 + 2") # 4
meth.evaluate("sqrt(9)") # 3

# evaluation with variables
evaluator = meth.Evaluator()
evaluator.evaluate("x = 5")
evaluator.evaluate("x") # 5
```
