178 releases

new 0.6.32-nightly.2 Feb 18, 2024
0.6.30-nightly.0 Jan 27, 2024
0.6.28 Dec 30, 2023
0.6.26 Nov 25, 2023
0.5.13 Nov 26, 2022

#362 in Parser implementations

Download history 522/week @ 2023-11-01 438/week @ 2023-11-08 429/week @ 2023-11-15 558/week @ 2023-11-22 853/week @ 2023-11-29 827/week @ 2023-12-06 799/week @ 2023-12-13 458/week @ 2023-12-20 714/week @ 2023-12-27 351/week @ 2024-01-03 346/week @ 2024-01-10 542/week @ 2024-01-17 657/week @ 2024-01-24 692/week @ 2024-01-31 387/week @ 2024-02-07 2141/week @ 2024-02-14

3,943 downloads per month
Used in 6 crates (3 directly)

MIT/Apache

1MB
24K SLoC

Erg parser

Use erg_parser as a Python library

erg_parser can be built as a Python library by using pyo3/maturin.

Example

import erg_parser

module = erg_parser.parse("x = 1")
for chunk in module:
    if isinstance(chunk, erg_parser.expr.Def):
        assert chunk.sig.inspect() == "x"

Debug install (using venv)

python -m venv .venv
source .venv/bin/activate
maturin develop --features pylib_parser

Release install

maturin build -i python --release --features pylib_parser
pip install <output wheel>

lib.rs:

Implements Parser for Erg. Parser parses the source code to generate AST. The generated ASTs are guaranteed to be identical if the source code is identical. However, identical ASTs may be generated even if the source code is (a bit) different.

Dependencies

~1.6–9MB
~68K SLoC