Alephc is a multi-language compiler and transpiler capable of parsing and generating code across multiple programming languages. It supports parsing Python, JavaScript, JSON, and the Aleph language, and can generate code in multiple target languages including Python, Erlang, Elixir, Gleam, and more.
- Aleph Language (
ale_parse): Parser for Aleph code - Python (
python_parse): Parser for Python code - JavaScript (
js_parse): Parser for JavaScript code - JSON (
json_parse): Parser for JSON structures
- Aleph Language (
ale_gen): Generator for Aleph code - Python (
python_gen): Generator for Python code - Erlang (
erlang_gen): Generator for Erlang code - Elixir (
elixir_gen): Generator for Elixir code - Gleam (
gleam_gen): Generator for Gleam code - JSON (
json_gen): Generator for JSON structures
- Rust (latest stable version recommended)
- Cargo (comes with Rust)
cargo buildcargo run -- [FEATURES] -- -i <INPUT_LANGUAGE> -o <OUTPUT_LANGUAGE> < <INPUT_FILE>The default features include: Aleph parsing/generation, JSON parsing/generation, Erlang generation, and Elixir generation.
cargo runcargo run --all-featurescargo run --features python_gen,erlang_gencargo run --all-features -- -i py -o ocaml < test/dataset/python/testInt.pyOr with full language names:
cargo run --all-features -- -i python -o ocaml < test/dataset/python/testInt.pycargo run --features js_parse,python_gen -- -i js -o python < test/dataset/js/testInt.jscargo run --features json_parse,erlang_gen -- -i json -o erlang < test/dataset/json/testInt.jsonaleoraleparse: Aleph languagepyorpython: Pythonjsorjavascript: JavaScriptjson: JSON
aleoralegen: Aleph languagepyorpython: Pythonerlang: Erlangelixir: Elixirgleam: Gleamjson: JSON
Code transformations can be applied using the -t or --transformer_list option:
cargo run --all-features -- -i python -o ocaml -t "transform1,transform2" < input.pyThe project includes a comprehensive test dataset located in test/dataset/ with examples in:
- Python (
test/dataset/python/) - JavaScript (
test/dataset/js/) - JSON (
test/dataset/json/) - Aleph (
test/dataset/ale/) - OCaml (
test/dataset/ocaml/)
The dataset includes examples covering various language constructs such as:
- Basic types (int, float, string, bool)
- Control structures (if, for, while)
- Functions and classes
- Sorting algorithms
- Mathematical operations
src/main.rs: Main entry point and CLI interfacesrc/filter/: Core compilation pipeline componentsparser/: Language parsersgen/: Code generatorstransform/: Code transformers
The Aleph compiler ecosystem includes several related projects:
- Aleph Compiler - Main compiler/transpiler
- Aleph Syntax Tree - Core syntax tree structure
- Beta Reduction - AST transformation engine
- Aleph Call - Erlang implementation caller
- Aleph Ollama - AI-powered translator
- Aleph Ollama Erlang - Erlang AI translation library
This project is licensed under the terms specified in the LICENSE file.
GitHub: https://github.com/aleph-lang/aleph
Contributions are welcome! Please feel free to submit pull requests or open issues for bugs and feature requests.
cargo build --releaseAfter building, you can use the compiled binary directly:
./target/release/alephc -i <INPUT_LANGUAGE> -o <OUTPUT_LANGUAGE> < <INPUT_FILE># Parse Python and generate OCaml using the binary
./target/release/alephc -i python -o ocaml < test/dataset/python/testInt.py
# Parse JavaScript and generate Python using the binary
./target/release/alephc -i js -o python < test/dataset/js/testInt.jsThe compiled binary supports the same options as cargo run, but feature flags must be selected during compilation rather than at runtime.
The project includes various test files in the test/dataset/ directory that you can use to verify functionality:
# Test Python to Aleph conversion
cargo run --all-features -- -i python -o ale < test/dataset/python/testInt.py
# Test Aleph to JSON conversion
cargo run -- -i ale -o json < test/dataset/ale/testInt.ale| Feature | Description | Default |
|---|---|---|
ale_parse |
Parse Aleph language | ✓ |
js_parse |
Parse JavaScript | - |
json_parse |
Parse JSON | ✓ |
python_parse |
Parse Python | - |
ale_gen |
Generate Aleph | ✓ |
json_gen |
Generate JSON | ✓ |
python_gen |
Generate Python | - |
erlang_gen |
Generate Erlang | ✓ |
elixir_gen |
Generate Elixir | ✓ |
gleam_gen |
Generate Gleam | - |