From 452507c60e644c5c6e9d83ca59b285e845bdb70e Mon Sep 17 00:00:00 2001 From: Erez Shinan Date: Thu, 2 Nov 2017 14:23:43 +0200 Subject: [PATCH] Improved README --- README.md | 96 +++++++++++++++++++++++++++---------------------------- 1 file changed, 48 insertions(+), 48 deletions(-) diff --git a/README.md b/README.md index 37f72f7..84c5d74 100644 --- a/README.md +++ b/README.md @@ -29,6 +29,8 @@ Most importantly, Lark will save you time and prevent you from getting parsing h Lark has no dependencies. +[![Build Status](https://travis-ci.org/erezsh/lark.svg?branch=master)](https://travis-ci.org/erezsh/lark) + ### Hello World Here is a little program to parse "Hello, World!" (Or any other similar phrase): @@ -60,6 +62,52 @@ See more [examples in the wiki](https://github.com/erezsh/lark/wiki/Examples) +## List of Features + + - Builds a parse-tree (AST) automagically, based on the structure of the grammar + - **Earley** parser + - Can parse *ALL* context-free grammars + - Full support for ambiguity in grammar + - **LALR(1)** parser + - Competitive with PLY + - **EBNF** grammar + - **Unicode** fully supported + - **Python 2 & 3** compatible + - Automatic line & column tracking + - Standard library of terminals (strings, numbers, names, etc.) + - Import grammars from Nearley.js + - Extensive test suite [![codecov](https://codecov.io/gh/erezsh/lark/branch/master/graph/badge.svg)](https://codecov.io/gh/erezsh/lark) + - And much more! + +See the full list of [features in the wiki](https://github.com/erezsh/lark/wiki/Features) + +### Performance comparison + +| Code | CPython Time | PyPy Time | CPython Mem | PyPy Mem +|:-----|:-------------|:------------|:----------|:--------- +| **Lark - LALR(1)** | 4.7s | 1.2s | 70M | 134M | +| PyParsing | 32s | 3.5s | 443M | 225M | +| funcparserlib | 8.5s | 1.3s | 483M | 293M | +| Parsimonious | | 5.7s | | 1545M | + +Check out the [JSON tutorial](/docs/json_tutorial.md#conclusion) for more details on how the comparison was made. + + +### Feature comparison + +| Library | Algorithm | Grammar | Builds tree? | Supports ambiguity? | Can handle every CFG? +|:--------|:----------|:----|:--------|:------------|:------------ +| **Lark** | Earley/LALR(1) | EBNF+ | Yes! | Yes! | Yes! | +| [PLY](http://www.dabeaz.com/ply/) | LALR(1) | Yacc-like BNF | No | No | No | +| [PyParsing](http://pyparsing.wikispaces.com/) | PEG | Parser combinators | No | No | No\* | +| [Parsley](https://pypi.python.org/pypi/Parsley) | PEG | EBNF-like | No | No | No\* | +| [funcparserlib](https://github.com/vlasovskikh/funcparserlib) | Recursive-Descent | Parser combinators | No | No | No | +| [Parsimonious](https://github.com/erikrose/parsimonious) | PEG | EBNF | Yes | No | No\* | + + +(\* *According to Wikipedia, it remains unanswered whether PEGs can really parse all deterministic CFGs*) + + ### Projects using Lark - [mappyfile](https://github.com/geographika/mappyfile) - a MapFile parser for working with MapServer configuration @@ -85,28 +133,6 @@ You can use the output as a regular python module: 0.38981434460254655 ``` -## List of Features - - - Builds a parse-tree (AST) automagically, based on the structure of the grammar - - **Earley** parser - - Can parse *ALL* context-free grammars - - Full support for ambiguity in grammar - - **LALR(1)** parser - - Competitive with PLY - - **EBNF** grammar - - **Unicode** fully supported - - **Python 2 & 3** compatible - - Automatic line & column tracking - - Standard library of terminals (strings, numbers, names, etc.) - - Import grammars from Nearley.js - - Extensive test suite - - And much more! - -See the full list of [features in the wiki](https://github.com/erezsh/lark/wiki/Features) - -[![codecov](https://codecov.io/gh/erezsh/lark/branch/master/graph/badge.svg)](https://codecov.io/gh/erezsh/lark) -[![Build Status](https://travis-ci.org/erezsh/lark.svg?branch=master)](https://travis-ci.org/erezsh/lark) - ## Comparison to other parsers ### Lark does things a little differently @@ -130,32 +156,6 @@ See the full list of [features in the wiki](https://github.com/erezsh/lark/wiki/ - You don't have to worry about terminals (regexps) or rules colliding - You can repeat expressions without losing efficiency (turns out that's a thing) -### Performance comparison - -| Code | CPython Time | PyPy Time | CPython Mem | PyPy Mem -|:-----|:-------------|:------------|:----------|:--------- -| **Lark - LALR(1)** | 4.7s | 1.2s | 70M | 134M | -| PyParsing | 32s | 3.5s | 443M | 225M | -| funcparserlib | 8.5s | 1.3s | 483M | 293M | -| Parsimonious | | 5.7s | | 1545M | - -Check out the [JSON tutorial](/docs/json_tutorial.md#conclusion) for more details on how the comparison was made. - - -### Feature comparison - -| Library | Algorithm | Grammar | Builds tree? | Supports ambiguity? | Can handle every CFG? -|:--------|:----------|:----|:--------|:------------|:------------ -| **Lark** | Earley/LALR(1) | EBNF+ | Yes! | Yes! | Yes! | -| [PLY](http://www.dabeaz.com/ply/) | LALR(1) | Yacc-like BNF | No | No | No | -| [PyParsing](http://pyparsing.wikispaces.com/) | PEG | Parser combinators | No | No | No\* | -| [Parsley](https://pypi.python.org/pypi/Parsley) | PEG | EBNF-like | No | No | No\* | -| [funcparserlib](https://github.com/vlasovskikh/funcparserlib) | Recursive-Descent | Parser combinators | No | No | No | -| [Parsimonious](https://github.com/erikrose/parsimonious) | PEG | EBNF | Yes | No | No\* | - - -(\* *According to Wikipedia, it remains unanswered whether PEGs can really parse all deterministic CFGs*) - ## License Lark uses the [MIT license](LICENSE).