The idea of this project is to implement an optimistic Cairo language compiler to run Cairo programs as fast as possible, while ignoring the checks that are present in a full-blown VM.
The first version won't be designed to generate executables, it will more similar to a JIT compiler.
First version
The initial version is just a simple VM with the required functionality, just to prove the concept. We will take our cairo-rs
VM and we will remove the trace generation and the memory checks to begin with.
To put it shortly this first version is a simplified version of the cairo-rs
VM.
It will load the JSON generated by StarkWare's cairo-compile
, run those instructions without any checks. It should be small.
Second version: Rust backend
The next iteration should add a Rust backend. That is, a backend that generates Rust code, compiles it, and finally executes it.
This version will still use the same JSON as the program input. This version may link to a runtime library for portions of code that doesn't make sense to codegen when outputting Rust code, such as BigInt operations and hint execution.
Third version: C or LLVM IR backend
After Rust, the next iteration should add either a C or an LLVM IR backend. It should speed up the compilation of the generated code into machine code, as well as its execution.
Full compiler
The final iteration will replace the JSON used until now with a cairo source code lexer and parser, therefore eliminating the need for cairo-compile
entirely.