{ "info": { "author": "wbond", "author_email": "will@wbond.net", "bugtrack_url": null, "classifiers": [ "Development Status :: 4 - Beta", "Intended Audience :: Developers", "License :: OSI Approved :: MIT License", "Operating System :: OS Independent", "Programming Language :: Python :: 2", "Programming Language :: Python :: 2.7", "Programming Language :: Python :: 3", "Programming Language :: Python :: 3.3", "Programming Language :: Python :: 3.4" ], "description": "========\nPyMeta3\n========\n\n--------------------------------------------\nA Pattern-Matching Language Based on Python\n--------------------------------------------\n\nThis is a fork of PyMeta 0.5.0 that supports Python 2 and 3.\n\n\nInstallation\n============\n\npip install PyMeta3\n\n\nSummary\n=======\n\nPyMeta is an implementation of OMeta, an object-oriented pattern-matching\nlanguage developed by Alessandro Warth\n(http://www.cs.ucla.edu/~awarth/ometa/). PyMeta provides a compact syntax based\non Parsing Expression Grammars (PEGs) for common lexing, parsing and\ntree-transforming activities in a way that's easy to reason about for Python\nprogrammers.\n\n\nHow It Works\n============\n\nPyMeta compiles a grammar to a Python class, with the rules as methods. The\nrules specify parsing expressions, which consume input and return values if\nthey succeed in matching.\n\nBasic syntax\n~~~~~~~~~~~~~~~~\n\n``foo ::= ....``\n Define a rule named foo.\n``expr1 expr2``\n Match expr1, and then match expr2 if it succeeds, returning the value of\n expr2. Like Python's ``and``.\n``expr1 | expr2``\n Try to match expr1 --- if it fails, match expr2 instead. Like Python's\n ``or``.\n``expr*``\n Match expr zero or more times, returning a list of matches.\n``expr+``\n Match expr one or more times, returning a list of matches.\n``expr?``\n Try to match expr. Returns None if it fails to match.\n``~expr``\n Fail if the next item in the input matches expr.\n````\n Call the rule ``ruleName``.\n``'x'``\n Match the literal character 'x'.\n``expr:name``\n Bind the result of expr to the local variable ``name``.\n``=> pythonExpression``\n Evaluate the given Python expression and return its result.\n\nComments like Python comments are supported as well, starting with #\nand extending to the end of the line.\n\nInterface\n=========\n\nThe starting point for defining a new grammar is\n``pymeta.grammar.OMeta.makeGrammar``, which takes a grammar definition and a\ndict of variable bindings for its embedded expressions and produces a Python\nclass. Grammars can be subclassed as usual, and makeGrammar can be called on\nthese classes to override rules and provide new ones. To invoke a grammar rule,\ncall ``grammarObject.apply()`` with its name.\n\nExample Usage\n=============\n\n>>> from pymeta.grammar import OMeta\n>>> exampleGrammar = \"\"\"\nones ::= '1' '1' => 1\ntwos ::= '2' '2' => 2\nstuff ::= ( | )+\n\"\"\"\n>>> Example = OMeta.makeGrammar(exampleGrammar, {})\n>>> g = Example(\"11221111\")\n>>> result, error = g.apply(\"stuff\")\n>>> result\n[1, 2, 1, 1]", "description_content_type": null, "docs_url": null, "download_url": null, "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "https://github.com/wbond/pymeta3", "keywords": null, "license": "MIT License", "maintainer": null, "maintainer_email": null, "name": "PyMeta3", "package_url": "https://pypi.org/project/PyMeta3/", "platform": "UNKNOWN", "project_url": "https://pypi.org/project/PyMeta3/", "project_urls": { "Homepage": "https://github.com/wbond/pymeta3" }, "release_url": "https://pypi.org/project/PyMeta3/0.5.1/", "requires_dist": null, "requires_python": null, "summary": "Pattern-matching language based on OMeta for Python 3 and 2", "version": "0.5.1" }, "last_serial": 2340406, "releases": { "0.5.0": [ { "comment_text": "", "digests": { "md5": "b5fd071fbc08a87142e9bb8f38a38070", "sha256": "7b1098c669ae007c23577cce180e1423bed6fb4867906ef892290a64c6b96130" }, "downloads": -1, "filename": "PyMeta3-0.5.0.tar.gz", "has_sig": false, "md5_digest": "b5fd071fbc08a87142e9bb8f38a38070", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 29660, "upload_time": "2015-01-14T17:24:54", "url": "https://files.pythonhosted.org/packages/9c/f3/9997a1f2f9a67ceea782704f56398cb5b2478928bc2b112141d936cae841/PyMeta3-0.5.0.tar.gz" } ], "0.5.1": [ { "comment_text": "", "digests": { "md5": "58f02ad5e4835a33ebbfa3d655238015", "sha256": "18bda326d9a9bbf587bfc0ee0bc96864964d78b067288bcf55d4d98681d05bcb" }, "downloads": -1, "filename": "PyMeta3-0.5.1.tar.gz", "has_sig": false, "md5_digest": "58f02ad5e4835a33ebbfa3d655238015", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 29566, "upload_time": "2015-02-22T16:30:06", "url": "https://files.pythonhosted.org/packages/ce/af/409edba35fc597f1e386e3860303791ab5a28d6cc9a8aecbc567051b19a9/PyMeta3-0.5.1.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "58f02ad5e4835a33ebbfa3d655238015", "sha256": "18bda326d9a9bbf587bfc0ee0bc96864964d78b067288bcf55d4d98681d05bcb" }, "downloads": -1, "filename": "PyMeta3-0.5.1.tar.gz", "has_sig": false, "md5_digest": "58f02ad5e4835a33ebbfa3d655238015", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 29566, "upload_time": "2015-02-22T16:30:06", "url": "https://files.pythonhosted.org/packages/ce/af/409edba35fc597f1e386e3860303791ab5a28d6cc9a8aecbc567051b19a9/PyMeta3-0.5.1.tar.gz" } ] }