{ "info": { "author": "Erez Shinan, Evandro Coan", "author_email": "erezshin@gmail.com", "bugtrack_url": null, "classifiers": [ "Development Status :: 1 - Planning", "Environment :: Console", "Intended Audience :: Developers", "License :: OSI Approved :: MIT License", "Operating System :: OS Independent", "Programming Language :: Python", "Programming Language :: Python :: 2", "Programming Language :: Python :: 2.7", "Programming Language :: Python :: 3", "Programming Language :: Python :: 3.3", "Programming Language :: Python :: 3.4", "Programming Language :: Python :: 3.5", "Programming Language :: Python :: 3.6", "Topic :: Software Development :: Libraries :: Python Modules", "Topic :: Text Processing :: General", "Topic :: Text Processing :: Linguistic" ], "description": "# Pushdown - a modern parsing library for Python\n\nThis project is a fork from https://github.com/lark-parser/lark,\nand the new name transition still in progress.\nThen,\nuntil this process is complete,\nyou should see the name `Lark` several places.\n\nParse any context-free grammar, FAST and EASY!\n\n**Beginners**:\nLark is not just another parser.\nIt can parse any grammar you throw at it,\nno matter how complicated or ambiguous,\nand do so efficiently.\nIt also constructs a parse-tree for you,\nwithout additional code on your part.\n\n**Experts**:\nLark lets you choose between Earley and LALR(1),\nto trade-off power and speed.\nIt also contains a CYK parser and unique features such as a contextual-lexer.\n\nLark can:\n\n - Parse all context-free grammars, and handle all ambiguity\n - Build a parse-tree automagically, no construction code required\n - Outperform all other Python libraries when using LALR(1) (Yes, including PLY)\n - Run on every Python interpreter (it's pure-python)\n - Generate a stand-alone parser (for LALR(1) grammars)\n\nAnd many more features. Read ahead and find out.\n\nMost importantly,\nLark will save you time and prevent you from getting parsing headaches.\n\n\n### Quick links\n\n- [Tutorial](/docs/json_tutorial.md) for writing a JSON parser.\n\n\n### Install pushdown\n\n $ pip install pushdown\n\nPushdown has no dependencies.\n\n\n### Syntax Highlighting (new)\n\nLark now provides syntax highlighting for its grammar files (\\*.lark):\n\n- [Sublime Text & TextMate](https://github.com/evandroforks/lark_syntax)\n\n\n### Hello World\n\nHere is a little program to parse \"Hello, World!\" (Or any other similar phrase):\n\n```python\nfrom lark import Lark\n\nl = Lark('''start: WORD \",\" WORD \"!\"\n\n %import common.WORD // imports from terminal library\n %ignore \" \" // Disregard spaces in text\n ''')\n\nprint( l.parse(\"Hello, World!\") )\n```\n\nAnd the output is:\n\n```python\nTree(start, [Token(WORD, 'Hello'), Token(WORD, 'World')])\n```\n\nNotice punctuation doesn't appear in the resulting tree. It's automatically filtered away by Lark.\n\n\n### Fruit flies like bananas\n\nLark is great at handling ambiguity. Let's parse the phrase \"fruit flies like bananas\":\n\n![fruitflies.png](examples/fruitflies.png)\n\nSee more [examples in the wiki](https://github.com/erezsh/lark/wiki/Examples)\n\n\n\n## List of main features\n\n - Builds a parse-tree (AST) automagically, based on the structure of the grammar\n - **Earley** parser\n - Can parse all context-free grammars\n - Full support for ambiguous grammars\n - **LALR(1)** parser\n - Fast and light, competitive with PLY\n - Can generate a stand-alone parser\n - **CYK** parser, for highly ambiguous grammars (NEW! Courtesy of [ehudt](https://github.com/ehudt))\n - **EBNF** grammar\n - **Unicode** fully supported\n - **Python 2 & 3** compatible\n - Automatic line & column tracking\n - Standard library of terminals (strings, numbers, names, etc.)\n - Import grammars from Nearley.js\n - And much more!\n\nSee the full list of [features in the wiki](https://github.com/erezsh/lark/wiki/Features)\n\n\n### Comparison to other libraries\n\n#### Performance comparison\n\nLark is the fastest and lightest (lower is better)\n\n![Run-time Comparison](docs/comparison_runtime.png)\n\n![Memory Usage Comparison](docs/comparison_memory.png)\n\n\nCheck out the [JSON tutorial](/docs/json_tutorial.md#conclusion) for more details on how the comparison was made.\n\n*Note: I really wanted to add PLY to the benchmark, but I couldn't find a working JSON parser anywhere written in PLY. If anyone can point me to one that actually works, I would be happy to add it!*\n\n\n#### Feature comparison\n\n| Library | Algorithm | Grammar | Builds tree? | Supports ambiguity? | Can handle every CFG? | Line/Column tracking | Generates Stand-alone\n|:--------|:----------|:----|:--------|:------------|:------------|:----------|:----------\n| **Lark** | Earley/LALR(1) | EBNF | Yes! | Yes! | Yes! | Yes! | Yes! (LALR only) |\n| [PLY](http://www.dabeaz.com/ply/) | LALR(1) | BNF | No | No | No | No | No |\n| [PyParsing](http://pyparsing.wikispaces.com/) | PEG | Combinators | No | No | No\\* | No | No |\n| [Parsley](https://pypi.python.org/pypi/Parsley) | PEG | EBNF | No | No | No\\* | No | No |\n| [funcparserlib](https://github.com/vlasovskikh/funcparserlib) | Recursive-Descent | Combinators | No | No | No | No | No |\n| [Parsimonious](https://github.com/erikrose/parsimonious) | PEG | EBNF | Yes | No | No\\* | No | No |\n| [ANTLR](https://github.com/antlr/antlr4) | LL(*) | EBNF | Yes | No | Yes? | Yes | No |\n\n\n(\\* *PEGs cannot handle non-deterministic grammars. Also, according to Wikipedia, it remains unanswered whether PEGs can really parse all deterministic CFGs*)\n\n\n### Projects using Lark\n\n - [mappyfile](https://github.com/geographika/mappyfile) - a MapFile parser for working with MapServer configuration\n - [pytreeview](https://gitlab.com/parmenti/pytreeview) - a lightweight tree-based grammar explorer\n - [tartiflette](https://github.com/dailymotion/tartiflette) - a GraphQL engine by Dailymotion (Lark is used to parse the GraphQL schemas definitions)\n\nUsing Lark? Send me a message and I'll add your project!\n\n\n### How to use Nearley grammars in Lark\n\nLark comes with a tool to convert grammars from [Nearley](https://github.com/Hardmath123/nearley), a popular Earley library for Javascript. It uses [Js2Py](https://github.com/PiotrDabkowski/Js2Py) to convert and run the Javascript postprocessing code segments.\n\nHere's an example:\n```bash\ngit clone https://github.com/Hardmath123/nearley\npython -m lark.tools.nearley nearley/examples/calculator/arithmetic.ne main nearley > ncalc.py\n```\n\nYou can use the output as a regular python module:\n\n```python\n>>> import ncalc\n>>> ncalc.parse('sin(pi/4) ^ e')\n0.38981434460254655\n```\n\n\n## License\n\nLark uses the [MIT license](LICENSE).\n\n(The standalone tool is under GPL2)\n\n\n## Contribute\n\nLark is currently accepting pull-requests.\n\nThere are many ways you can help the project:\n\n* Help solve issues\n* Improve the documentation\n* Write new grammars for Lark's library\n* Write a blog post introducing Lark to your audience\n* Port Lark to another language\n* Help me with code developemnt\n\nIf you're interested in taking one of these on, let me know and I will provide more details and assist you in the process.\n\n\n## Donate\n\nFor the original project called `lark-parser`, see: https://github.com/lark-parser/lark#donate\n\n\n## Contact\n\nFor the original project called `lark-parser`, see: https://github.com/lark-parser/lark#contact\n\nFor this fork project called `pushdown`,\nopen a new issue on:\nhttps://github.com/evandrocoan/pushdown/issues", "description_content_type": "text/markdown", "docs_url": null, "download_url": "https://github.com/evandrocoan/pushdown/archive/master.zip", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "https://github.com/evandrocoan/pushdown", "keywords": "Earley LALR parser parsing ast", "license": "MIT", "maintainer": "", "maintainer_email": "", "name": "pushdown", "package_url": "https://pypi.org/project/pushdown/", "platform": "", "project_url": "https://pypi.org/project/pushdown/", "project_urls": { "Download": "https://github.com/evandrocoan/pushdown/archive/master.zip", "Homepage": "https://github.com/evandrocoan/pushdown" }, "release_url": "https://pypi.org/project/pushdown/0.6.7/", "requires_dist": null, "requires_python": "", "summary": "A fork form lark-parser, a modern parsing library", "version": "0.6.7" }, "last_serial": 4425468, "releases": { "0.6.7": [ { "comment_text": "", "digests": { "md5": "4af1e0e51e55d84a1c1c2d11f4be8ade", "sha256": "e1e9469c2774c6f1e10b6a1ce5ad1832b66f9046f075d7c7bb325200963e80f7" }, "downloads": -1, "filename": "pushdown-0.6.7.tar.gz", "has_sig": false, "md5_digest": "4af1e0e51e55d84a1c1c2d11f4be8ade", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 261310, "upload_time": "2018-10-28T23:16:53", "url": "https://files.pythonhosted.org/packages/c7/3a/9d3230aa6bf5471b4b035bb6a633f806d23c0d93837d8b18c7cb40e6ea11/pushdown-0.6.7.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "4af1e0e51e55d84a1c1c2d11f4be8ade", "sha256": "e1e9469c2774c6f1e10b6a1ce5ad1832b66f9046f075d7c7bb325200963e80f7" }, "downloads": -1, "filename": "pushdown-0.6.7.tar.gz", "has_sig": false, "md5_digest": "4af1e0e51e55d84a1c1c2d11f4be8ade", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 261310, "upload_time": "2018-10-28T23:16:53", "url": "https://files.pythonhosted.org/packages/c7/3a/9d3230aa6bf5471b4b035bb6a633f806d23c0d93837d8b18c7cb40e6ea11/pushdown-0.6.7.tar.gz" } ] }