erg/crates/erg_parser
2024-08-19 22:45:15 +09:00
..
tests refactor!: rename Array -> List 2024-04-04 23:24:07 +09:00
.gitignore Rename dir: compiler -> crates 2023-01-15 12:03:19 +09:00
ast.rs feat: set type variable 2024-08-19 22:45:15 +09:00
build_ast.rs impl: expect the block 2024-02-20 23:41:41 +09:00
Cargo.toml chore: add log-level-error feature 2024-06-16 13:40:36 +09:00
convert.rs refactor!: rename Array -> List 2024-04-04 23:24:07 +09:00
desugar.rs chore: error report delay with variable defs 2024-08-18 13:18:20 +09:00
error.rs refactor!: rename Array -> List 2024-04-04 23:24:07 +09:00
lex.rs Update lex.rs 2024-05-12 13:47:18 +09:00
lib.rs build: update pyo3 to v0.21 2024-07-02 03:15:28 +09:00
main.rs chore: name the spawned thread 2023-03-22 22:00:38 +09:00
parse.rs fix: eliminate unwrap/unreachable 2024-06-17 13:09:50 +09:00
README.md feat: make erg_compiler available as a Python lib 2023-11-15 11:20:10 +09:00
token.rs feat!: remove dot, cross operator 2024-01-28 22:19:15 +09:00
typespec.rs fix: eliminate unwraps 2024-05-02 22:16:54 +09:00
visitor.rs feat: add ASTVisitor 2023-11-08 00:27:49 +09:00

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>