AirScript Compiler
This crate aggregates all components of the AirScript compiler into a single place. Specifically, it re-exports functionality from the parser, ir, and winterfell code generator crates. Additionally, when compiled as an executable, this crate can be used via a CLI to transpile AIRs defined in AirScript to a specified target language.
Basic Usage
An in-depth description of AirScript is available in the full AirScript documentation.
The compiler has three stages, which can be imported and used independently or together.
- Parser: scans and parses AirScript files and builds an AST
- IR: produces an intermediate representation from an AirScript AST
- Code generation: translate an
AirIR
into a specific target language- Winterfell Code Generator: generates Rust code targeting the Winterfell prover.
Example usage:
use ;
use ;
// Used for diagnostics reporting
let codemap = new;
let emitter = new;
let diagnostics = new;
// Parse into AST
let ast = parse.expect;
// Lower to IR
let air = ;
// Generate Rust code targeting the Winterfell prover
let code = new.generate.expect;
An example of an AIR defined in AirScript can be found in the examples/
directory.
To run the full transpilation pipeline, the CLI can be used for convenience.
Command-Line Interface (CLI)
There is a command-line interface available for transpiling AirScript files. Currently, the only available target is Rust code for use with the Winterfell STARK prover library.
To use the CLI, first run:
cargo build --release
Then, run the airc
target with the transpile
. For example:
./target/release/airc transpile examples/example.air
When no output destination is specified, the output file will use the path and name of the input file, replacing the .air
extension with .rs
. For the above example, examples/example.rs
will contain the generated output.
You can use the help
option to see other available options.
./target/release/airc transpile --help