1. 36

  2. 14

    After 4 years of fixing issues and merging pull-requests, we found that Lark has grown a little encumbered, like a lobster that’s grown too big for its shell. And so, like that proverbial lobster, we took the opportunity of a new major version to break the shell and make a few backward-incompatible changes.

    Chiefly among the changes, Lark 1.0 dropped Python 2 support, and instead now uses the full range of Python 3 features, including type annotations. The API has also been straightened out and made more congruous. A full list of the changes is available in the release notes: https://github.com/lark-parser/lark/releases/tag/1.0.0

    While version 1.0 itself doesn’t boast big new features (other than marking the API as stable), Lark has accumulated many cool features over the years, that even avid users may have missed:

    • Grammar composition - lark grammars can import rules from other grammars, and extend or override them (think inheritance).
    • Interactive parser - an interface that allows you to parse step-by-step. Useful for error handling and unusual parsing flows.
    • Reconstructor - using a grammar and a parse tree, Lark can generate text that would parse into that tree.
    • Ports - In addition to Python, you can also use Lark grammars to create parsers in Julia and Javascript.
    • Online IDE - you can try Lark in your browser. Useful for teaching parsing? - https://www.lark-parser.org/ide/

    If you never tried Lark, perhaps now is the time!

    See our project page to learn more: https://github.com/lark-parser/lark

    1. 2

      Lark was already my favorite parser library for Python, and the new interactive parser, grammar composition, and tree templates all look really interesting! Really excited to try this out :D

      1. 4

        That’s only a partial list of all the features we added over time.

        I’m planning to write a more detailed blog post on all these and more.