GitHub About: Future home of the DEXA reference compiler. Developed in private monorepo until 1.0.0.
Reference compiler for DEXA — a statically typed, deterministic language for the DXA stack (GPU kernels, native binaries, contract VMs). Written in Rust.
Status: This repo is a placeholder. The compiler is currently developed in dxa-dev. When the monorepo is split, this repo will hold the compiler source, CLI, and examples.
What’s here now: A minimal stub you can build and run: src/lib.rs exposes run_source() (returns an error directing to dxa-dev) and VERSION; src/main.rs is a dxc CLI that reads a file and calls run_source. Run cargo build --release and ./target/release/dxc any.dxa to see the placeholder message.
- Input: DEXA source (
.dxafiles) — functions, models, contracts, top-levelletglobals. - Pipeline: Lexer → Parser (AST) → Typechecker → Lowering (DX-IR) → IR validation → Interpreter.
- Output: Program result (value, prints, execution trace, gas used) or a typed error with line/column and source snippet where available.
The compiler is single-pass: no separate “runtime” binary; the same binary compiles and executes. Future backends (LLVM, GPU, DX-VM) are planned; today only the interpreter runs.
Right now you’ll get the full compiler (currently a stub: usage + placeholder error):
dxc <file.dxa>- Success: Prints program output, result value, and gas (steps).
- Failure: Exit code 1 with lex/parse/typecheck/IR or runtime error (e.g.
requirefailure).
Intended public surface (from the current dxa-dev implementation):
| Function | Description |
|---|---|
run_source(source: &str) |
Compile and run a string; returns Result<ProgramResult, DexaError>. |
run_source_with_debug(source: &str) |
Same, plus pretty-printed AST and IR for tooling/debugging. |
run_file(path: &Path) |
Read file and run (convenience over run_source). |
Re-exported types: DexaError, ProgramResult, ExecutionTrace, GasMeter, Value (runtime value).
- Version: 0.1.0 (aligned with dxa-dev).
- Rust: Edition 2021.
- Dependencies:
thiserror(errors). No runtime deps.
cargo build --release
cargo testThe stub builds today; the dxc CLI is in src/main.rs, the library in src/lib.rs. After the split, the same commands will build the full compiler.
When split, example .dxa files (e.g. hello.dxa, wallet.dxa, loops.dxa, builtins and error-case tests) will live in an examples/ directory here or in the dxa-dev repo until the split.
Apache 2.0 (to match the compiler crate in dxa-dev).