{ "info": { "author": "Allen Short", "author_email": "washort42@gmail.com", "bugtrack_url": null, "classifiers": [], "description": "========\nPyMeta\n========\n\n--------------------------------------------\nA Pattern-Matching Language Based on Python\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": "UNKNOWN", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "http://launchpad.net/pymeta", "keywords": null, "license": "MIT License", "maintainer": null, "maintainer_email": null, "name": "PyMeta", "package_url": "https://pypi.org/project/PyMeta/", "platform": "UNKNOWN", "project_url": "https://pypi.org/project/PyMeta/", "project_urls": { "Download": "UNKNOWN", "Homepage": "http://launchpad.net/pymeta" }, "release_url": "https://pypi.org/project/PyMeta/0.5.0/", "requires_dist": null, "requires_python": null, "summary": "Pattern-matching language based on OMeta", "version": "0.5.0" }, "last_serial": 585666, "releases": { "0.5.0": [ { "comment_text": "", "digests": { "md5": "f7c9cf93ef0c2a9d273f90563f9a0cfd", "sha256": "e647e739d1aa8b32958d6922af69dabe117bc8b369201deb1e51adb9a6cb9b9b" }, "downloads": -1, "filename": "PyMeta-0.5.0.tar.gz", "has_sig": true, "md5_digest": "f7c9cf93ef0c2a9d273f90563f9a0cfd", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 28933, "upload_time": "2013-03-12T15:45:53", "url": "https://files.pythonhosted.org/packages/ac/8e/677557793fada7e75f97a098bede3a606e57668e1ded2faba3b83d4716fb/PyMeta-0.5.0.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "f7c9cf93ef0c2a9d273f90563f9a0cfd", "sha256": "e647e739d1aa8b32958d6922af69dabe117bc8b369201deb1e51adb9a6cb9b9b" }, "downloads": -1, "filename": "PyMeta-0.5.0.tar.gz", "has_sig": true, "md5_digest": "f7c9cf93ef0c2a9d273f90563f9a0cfd", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 28933, "upload_time": "2013-03-12T15:45:53", "url": "https://files.pythonhosted.org/packages/ac/8e/677557793fada7e75f97a098bede3a606e57668e1ded2faba3b83d4716fb/PyMeta-0.5.0.tar.gz" } ] }