Coder Social home page Coder Social logo

air-script's Introduction

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.
AirScript Core Exports commonly used constants and structs used by the other crates.
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.

Tests

  1. git submodule update --init --recursive
  2. cargo run --bin airc -- transpile -i examples/example.air

Winterfell

  1. cp examples/example.rs examples/tests/winterfell/src/example.rs
  2. cargo run --bin winterfell --release
  3. The above will generate a example.wlog file containing the reference values for testing

Cairo

  1. cp examples/example.cairo examples/tests/cairo/
  2. protostar -p unit test

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.