erg/crates/erg_parser
2023-12-06 18:31:03 +09:00
..
tests chore: add New trait 2023-11-03 12:56:46 +09:00
.gitignore Rename dir: compiler -> crates 2023-01-15 12:03:19 +09:00
ast.rs fix: external pylib bugs 2023-12-06 18:31:03 +09:00
build_ast.rs chore: add New trait 2023-11-03 12:56:46 +09:00
Cargo.toml feat: make erg_compiler available as a Python lib 2023-11-15 11:20:10 +09:00
convert.rs feat: add kw-var-args 2023-11-12 09:52:59 +09:00
desugar.rs feat: add kw-var-args 2023-11-12 09:52:59 +09:00
error.rs feat: make erg_parser available as a Python lib 2023-11-14 20:47:01 +09:00
lex.rs feat: add kw-var-args 2023-11-12 09:52:59 +09:00
lib.rs feat: add erg_compiler/erg_parser type decls 2023-11-18 16:04:51 +09:00
main.rs chore: name the spawned thread 2023-03-22 22:00:38 +09:00
parse.rs feat: make erg_parser available as a Python lib 2023-11-14 20:47:01 +09:00
README.md feat: make erg_compiler available as a Python lib 2023-11-15 11:20:10 +09:00
token.rs feat: impl setter for AST elements 2023-11-16 16:15:29 +09:00
typespec.rs feat: add SubrType::kw_var_params 2023-11-12 12:22:48 +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>