Over the last few years, Lark has grown to become a comprehensive toolkit for parsing structured text.
Today, I'm happy to announce the long anticipated version 1.0 of Lark, marking the API as stable.
We've made quite a few breaking changes, in order to achieve congruous API with as little "gotchas" as possible. Upgrading to version 1.0 might require a few changes to your project.
Breaking changes
- **Dropped Python 2** support! Lark now only supports Python 3.6 and up.
- Install lark using `pip install lark` (instead of lark-parser ).
- `maybe_placeholders` is now True by default.
- Renamed `TraditionalLexer` to `BasicLexer`, and `'standard'` lexer option to `'basic'`.
- Default priority is now 0, for both terminals and rules (used to be 1 for terminals).
- Discard mechanism is now done by returning Discard, instead of raising it as an exception.
- `use_accepts` in `UnexpectedInput.match_examples()` is now True by default.
- `v_args(meta=True)` now gives meta as the first argument. i.e. `(meta, children)`.
Improvments
- Better type annotations
- Support for terminal priorities for dynamic Earley
- Python3 grammar is now officially supported, and can be used via `%import python (...)`
- New experimental feature: Tree Templates
- Various bugfixes
Acknowledgements
Many thanks to all our contributors and donors, who made this release possible. Special thanks goes to -
- MegaIng, for innumerous features, bugfixes, and code-reviews.
- chanicpanic, for his immense and continual contributions to the Earley parser, and for helping with the v1.0 effort.
- erezsh, for being myself.