Skip to content

A domain-specific language for writing AIR constraints for STARKs

License

Notifications You must be signed in to change notification settings

0xPolygonMiden/air-script

Repository files navigation

AirScript

A domain-specific language for expressing AIR constraints for STARKs, especially for STARK-based virtual machines like Miden VM.

An in-depth description of AirScript is available in the full AirScript documentation.

WARNING: This project is in an alpha stage. It has not been audited and may contain bugs and security flaws. This implementation is NOT ready for production use.

Overview

AirScript is a domain-specific language for writing AIR constraints for the STARK proving system. The primary goal of AirScript is to enable writing and auditing AIR constraints without the need to learn a specific programming language (e.g., Rust). The secondary goal is to perform automated optimizations of constraints and to output constraint evaluator code in multiple target languages (e.g., Rust, Miden assembly, Solidity etc.).

Project Structure

The project is organized into several crates as follows:

Crate Description
Parser Contains the parser for AirScript. The parser is used to parse the constraints written in AirScript into an AST.
IR Contains the IR for AirScript, AirIR. AirIR is initialized with an AirScript AST, which it converts to an internal representation that can be optimized and used to generate code in multiple target languages.
Winterfell code generator Contains a code generator targeting the Winterfell prover Rust library. The Winterfell code generator converts a provided AirScript AirIR into Rust code that represents the AIR as a new custom struct that implements Winterfell's Air trait.
Miden assembly code generator Contains code generator targeting the Miden VM. Miden assembly code generator converts AirIR into Miden assembly module contain constraint evaluation and related logic.
AirScript Aggregates all components of the AirScript compiler into a single place and provides a CLI as an executable to transpile AIRs defined in AirScript to the specified target language. Also contains integration tests for AirScript.

Contributing to AirScript

AirScript is an open project and we welcome everyone to contribute! If you are interested in contributing to AirScript, please have a look at our Contribution guidelines. If you want to work on a specific issue, please add a comment on the GitHub issue indicating you are interested before submitting a PR. This will help avoid duplicated effort. If you have thoughts on how to improve AirScript, we'd love to know them. So, please don't hesitate to open issues.

References

  1. Logos: Library for generating fast lexers in Rust.
  2. LALRPOP: LR(1) Rust parser generator framework.
  3. Codegen: Library for generating Rust code.
  4. mdBook: Utility for creating online documentation books.

License

This project is MIT licensed.