meth: A mathematical expression evaluator.
A python package to parse and evaluate mathematical expressions.
Installation
pip install meth
or install it from source:
git clone https://github.com/sertdfyguhi/meth/
cd meth
python3 -m build
pip install dist/*.whl
Examples
More examples in the examples/ directory.
import meth
# tokenizing expression
meth.tokenize("5 + 2") # [Token(TokenType.NUMBER, 5), Token(TokenType.ADD), Token(TokenType.NUMBER, 2)]
# parsing expression
meth.parse("7 * 2") # BinaryOp(Number(7), TokenType.MUL, Number(2))
# evaluating expression
meth.evaluate("4 ^ 2") # 16
meth.evaluate("3(1 + 2)") # 9
meth.evaluate("sqrt(9)") # 3
# evaluation with variables
evaluator = meth.Evaluator()
evaluator.evaluate("x = 5")
evaluator.evaluate("x") # 5
Metadata
Release files for meth 2.1.2
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| meth-2.1.2.tar.gz | 21.5 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| meth-2.1.2-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 44.8 kB
Release files / meth-2.1.2.tar.gz
| Download URL | meth-2.1.2.tar.gz |
|---|---|
| Size | 21.5 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
59f2502898a8cc215db033a1444aeed4e8e4ceed222faa3662072d18c652a46e
|
|
BLAKE2b-256 checksum How to use checksums |
3f78ccb5789b12e8ce2bad8d100be77208c79e43b58a33c1bb2785c5d9a3669b
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.13.13
|
Release files / meth-2.1.2-py3-none-any.whl
| Download URL | meth-2.1.2-py3-none-any.whl |
|---|---|
| Size | 23.3 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
e95bce80b1dd37ed510c032823e5cb55c0350320f6f2f748a98da80a1149f3ac
|
|
BLAKE2b-256 checksum How to use checksums |
44b7c26df015b3cb9dace1c36d5cdf71391c999f7048cea7c24cc85a2ccdff84
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.13.13
|