A Rust implementation of the Alpha language polyhedral compilation toolchain: parse → semantic analysis → normalize → generate C.
alphac is the CLI this workspace builds: alphac file.alpha -o file.c.
For the full design rationale (why isl via FFI, workspace layout, licensing, scope) see
docs/design.md. For current status, known bugs, and next steps see
docs/progress.md. Each crate also has its own README.
- uv, to run
prekfor pre-commit hooks (see Pre-commit hooks below):curl -LsSf https://astral.sh/uv/install.sh | sh - Rust, via rustup (not a system package manager):
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y source "$HOME/.cargo/env" - isl (>= 0.18) and pkg-config. On macOS:
Homebrew installs
brew install isl pkg-configpkg-configto/opt/homebrew/bin, which isn't always onPATHin non-interactive shells — prefix commands withexport PATH="/opt/homebrew/bin:$PATH"ifcargo buildreports it can't find isl (the Makefile below already does this for you). - libclang, for
bindgen. On macOS this ships with the Xcode Command Line Tools. - Barvinok: not required.
barvinok/barvinok-sysare stub crates gated behind the off-by-defaultbarvinokCargo feature.
Linux/macOS only — no Windows support (isl depends on GMP, which complicates static linking on Windows).
make build # debug build, whole workspace
make release # optimized build; alphac lands at target/release/alphac
Equivalent plain-cargo commands (see the Makefile for the exact PATH handling):
cargo build --workspace
cargo build --workspace --release
make test
or cargo test --workspace. Conformance tests read .alpha fixtures bundled in this repo under
tests/alpha-language-fixtures/ (copied from the upstream
alpha-language repo's tests/**).
cargo run -p alphac -- path/to/file.alpha -o path/to/file.c
Without -o, generated C is printed to stdout.
make check # cargo check --workspace
make clippy # cargo clippy --workspace --all-targets
make fmt # cargo fmt --all
make lint # uv run prek run --all-files (all pre-commit hooks)
make clean # cargo clean
This repo uses prek (a fast, Rust-based reimplementation of
pre-commit) to run formatting and lint checks before each commit, managed as a uv dev
dependency (see pyproject.toml):
uv sync # one-time: creates .venv, installs prek
uv run prek install # one-time: installs the git hook
Hooks then run automatically on git commit. To run them manually against all files:
make lint # or: uv run prek run --all-files
Configured hooks: cargo fmt --check, cargo clippy --workspace --all-targets -- -D warnings,
cargo check --workspace, plus standard whitespace/YAML/TOML hygiene checks. See
.pre-commit-config.yaml.
MIT by default (see each crate's Cargo.toml), matching the upstream isl library. The optional
barvinok/barvinok-sys crates are GPL-licensed and feature-gated off by default — nothing
in a default build pulls in GPL code. See docs/design.md for the full
licensing rationale.