lark-parser / lark_cython

Cython plugin for Lark, reimplementing the LALR parser & lexer for better performance
MIT License
44 stars 5 forks source link

Lark-Cython

Cython plugin for Lark, reimplementing the LALR parser & lexer for better performance on CPython.

Install:

pip install lark-cython

Usage:

import lark_cython

parser = Lark(grammar, parser="lalr", _plugins=lark_cython.plugins)

# Use Lark as you usually would, with a huge performance boost

See the examples for more.

Differences from Lark

Other caveats

Speed

In current benchmarks, lark-cython is about 50% to 80% faster than Lark.

We're still in the early stages, and in the future, lark-cython might go a lot faster.

Other

License: MIT

Author: Erez Shinan

Special thanks goes to Datafold for commissioning the draft for lark-cython, and allowing me to release it as open-source.