meth


Namemeth JSON
Version 1.2.1 PyPI version JSON
download
home_page
SummaryA mathematical expression parser and evaluator.
upload_time2023-09-14 09:14:03
maintainer
docs_urlNone
authorsertdfyguhi
requires_python>=3.0
license
keywords evaluator math math evaluator math parser mathematical parser parsing
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # 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
meth.tokenize("5 + 2") # INT(5), PLUS, INT(2)

# parsing equations
meth.parse("2 * 10") # BinaryOpNode(INT(2), MUL, INT(10))

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

# Todo

- [x] Lexer
- [x] Parser
  - [x] Bracketing
  - [x] Multiplication using brackets
  - [x] Negative Numbers
  - [x] Variables
  - [x] Functions
- [x] Interpreter
  - [x] Binary Operations
  - [x] Unary Operations
  - [x] Variables
  - [x] Functions
- [x] Add mathematical functions
- [ ] Accurate float calculations
- [ ] Simplify an expression
- [ ] Expand an expression
- [x] AST to Equation String
- [ ] Documentation
- [x] Publish to PyPI

            

Raw data

            {
    "_id": null,
    "home_page": "",
    "name": "meth",
    "maintainer": "",
    "docs_url": null,
    "requires_python": ">=3.0",
    "maintainer_email": "",
    "keywords": "evaluator,math,math evaluator,math parser,mathematical,parser,parsing",
    "author": "sertdfyguhi",
    "author_email": "",
    "download_url": "https://files.pythonhosted.org/packages/c5/57/811cbe8e72a898fdf8b85903a04a7fcdc5a2369a2154dcf2781be664edc6/meth-1.2.1.tar.gz",
    "platform": null,
    "description": "# meth: A mathematical expression parser.\n\nA python package to parse and evaluate mathematical expressions.\n\n# Installation\n\n```sh\npip install meth\n```\n\nor install it from source:\n\n```sh\ngit clone https://github.com/sertdfyguhi/meth/\ncd meth\npython3 -m build\npip install dist/*.whl\n```\n\n# Examples\n\n> _More examples in the [examples/](https://github.com/sertdfyguhi/meth/tree/master/examples) directory._\n\n```py\nimport meth\n\n# tokenizing equations\nmeth.tokenize(\"5 + 2\") # INT(5), PLUS, INT(2)\n\n# parsing equations\nmeth.parse(\"2 * 10\") # BinaryOpNode(INT(2), MUL, INT(10))\n\n# evaluating equations\nmeth.evaluate(\"2 + 2\") # 4\nmeth.evaluate(\"sqrt(9)\") # 3\n\n# evaluation with variables\nevaluator = meth.Evaluator()\nevaluator.evaluate(\"x = 5\")\nevaluator.evaluate(\"x\") # 5\n```\n\n# Todo\n\n- [x] Lexer\n- [x] Parser\n  - [x] Bracketing\n  - [x] Multiplication using brackets\n  - [x] Negative Numbers\n  - [x] Variables\n  - [x] Functions\n- [x] Interpreter\n  - [x] Binary Operations\n  - [x] Unary Operations\n  - [x] Variables\n  - [x] Functions\n- [x] Add mathematical functions\n- [ ] Accurate float calculations\n- [ ] Simplify an expression\n- [ ] Expand an expression\n- [x] AST to Equation String\n- [ ] Documentation\n- [x] Publish to PyPI\n",
    "bugtrack_url": null,
    "license": "",
    "summary": "A mathematical expression parser and evaluator.",
    "version": "1.2.1",
    "project_urls": {
        "Bug Tracker": "https://github.com/sertdfyguhi/meth/issues",
        "Homepage": "https://github.com/sertdfyguhi/meth"
    },
    "split_keywords": [
        "evaluator",
        "math",
        "math evaluator",
        "math parser",
        "mathematical",
        "parser",
        "parsing"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "15dbecdeda02dfc20c668eebf9165231cb4bf36308afe70482d99d90822514b8",
                "md5": "17071f9990f6212363e01416b6d711eb",
                "sha256": "e6a1644775bec71fbaab451de96162f245f57942028504d12cbdea92bf757ba3"
            },
            "downloads": -1,
            "filename": "meth-1.2.1-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "17071f9990f6212363e01416b6d711eb",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.0",
            "size": 24018,
            "upload_time": "2023-09-14T09:13:59",
            "upload_time_iso_8601": "2023-09-14T09:13:59.222280Z",
            "url": "https://files.pythonhosted.org/packages/15/db/ecdeda02dfc20c668eebf9165231cb4bf36308afe70482d99d90822514b8/meth-1.2.1-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "c557811cbe8e72a898fdf8b85903a04a7fcdc5a2369a2154dcf2781be664edc6",
                "md5": "1116d246b23c04d1022cc9ee81840d63",
                "sha256": "abd8e09b61d67b565bad4af6cdb20ed3f56900e8d45739289d3324c6fe1cf7b3"
            },
            "downloads": -1,
            "filename": "meth-1.2.1.tar.gz",
            "has_sig": false,
            "md5_digest": "1116d246b23c04d1022cc9ee81840d63",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.0",
            "size": 21201,
            "upload_time": "2023-09-14T09:14:03",
            "upload_time_iso_8601": "2023-09-14T09:14:03.398282Z",
            "url": "https://files.pythonhosted.org/packages/c5/57/811cbe8e72a898fdf8b85903a04a7fcdc5a2369a2154dcf2781be664edc6/meth-1.2.1.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2023-09-14 09:14:03",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "sertdfyguhi",
    "github_project": "meth",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": false,
    "lcname": "meth"
}
        
Elapsed time: 0.32930s