Crates.io | erg_compiler |
lib.rs | erg_compiler |
version | |
source | src |
created_at | 2022-08-11 02:28:52.601649 |
updated_at | 2024-12-12 16:48:14.531837 |
description | Centimetre: the Erg compiler |
homepage | https://erg-lang.org/ |
repository | https://github.com/erg-lang/erg |
max_upload_size | |
id | 643050 |
Cargo.toml error: | TOML parse error at line 18, column 1 | 18 | autolib = false | ^^^^^^^ unknown field `autolib`, expected one of `name`, `version`, `edition`, `authors`, `description`, `readme`, `license`, `repository`, `homepage`, `documentation`, `build`, `resolver`, `links`, `default-run`, `default_dash_run`, `rust-version`, `rust_dash_version`, `rust_version`, `license-file`, `license_dash_file`, `license_file`, `licenseFile`, `license_capital_file`, `forced-target`, `forced_dash_target`, `autobins`, `autotests`, `autoexamples`, `autobenches`, `publish`, `metadata`, `keywords`, `categories`, `exclude`, `include` |
size | 0 |
The overall structure is described in detail in architecture.md(English).For other language translations of architecture.md, please check them out by yourself.
erg_compiler
as a Python libraryerg_compiler
can be built as a Python library by using pyo3/maturin.
import erg_compiler
module = erg_compiler.exec_module(".i = 1")
# foo.er:
# .bar = 1
foo = erg_compiler.__import__("foo")
assert module.i == 1
assert foo.bar == 1
import erg_compiler
erg_parser = erg_compiler.erg_parser
erg_ast = erg_compiler.erg_parser.ast
module = erg_parser.parse(".i = 1")
d = module.pop()
d.sig = erg_ast.VarSignature.new(erg_ast.Identifier.public("j"), None)
module.push(d)
ast = erg_ast.AST.new("test", module)
code = erg_compiler.compile_ast(ast)
exec(code)
assert j == 1
python -m venv .venv
source .venv/bin/activate
maturin develop --features pylib_compiler
maturin build -i python --release --features pylib_compiler
pip install <output wheel>