Skip to content

anoma/alucard

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Alu

Description

ALucard (Alu) is a high level DSL for writing Zero Knowledge circuits. Alu compiles to a constraint agnostic system known as vamp-ir which allows easy integration and deployment into existing Zero Knowledge stacks or private applications into new systems.

Since Alu is a DSL, it’s syntax is heavily inspired from it’s host language Common lisp, extending the language with circuit compilation capabilities. This means that Alucard can use language infrastructure like FiveAM and SWANK to allow a battle tested interactive developer experience.

Quick Start

A friendly introduction can be found here

Documentation

The most complete documentation is the Alucard Reference Manual.

For those curious about test coverage, the test coverage of the compiler can be found here.

Editor Integration

Since Alucard Relies on Common lisp, we support all major editors. For the best experience Emacs is recommend though the other editors work well!

Emacs

With Emacs you have a few choices for easy editor integration, either:

Then you just have to set the default lisp program to alucard.

(setq inferior-lisp-program "alu.image")

If you don’t wish for the default implementation to be alucard, then alu.image can be passed in manually when calling M-x sly (In helm this is C-u before running the command)

VSCode

Alive

With Alive Alucard integration is quite simple, just grab the extension off the marketplace and then edit the settings.json with

However the following dependencies will also be needed

  • alive-lsp
    • This can be installed with
    • ros install "nobody-famous/alive-lsp"
{
    "alive.lsp.startCommand": [
        "alu.image",
        "-a"
    ]
}

when now connecting to a .lisp file, alucard will automatically be booted up. Note that to get alucard in the right package, in the bottom left prompt in the REPL tab, you should click on the cl-user and type in aluser to set the system in the right package.

Vim

vlime [TODO]

Terminal

Alucard can be launched from the terminal and attach to your editor as well. This can be done by launching the program with -s for swank or -y for sly. Once done you should be given a REPL on the terminal along with the message

;; Swank started at port: 4005.

This means that you can hookup your editor of choice to localhost:4005 via sly-connect or alive attach to REPL.

For Developers

Test Coverage

  • Test coverage can be found here.

Setting up the Developer Environment

Alucard works on many different implementations of CL, namely

  • SBCL
  • CCL
  • ECL

To quickly get started with Alucard development, one can run the following commands from their lisp REPL

  • (load "alu.asd")
  • (ql:quickload :alu/test)
    • If one is using CLPM then you should run (activate-project) instead.
  • (asdf:test-system :alu)

If there was an error in the above commands, look at the section below for some common solutions.

If the commands work, then you can start hacking on Alucard!

Currently binary extraction does not work with SBCL, but it is perfectly fit to load the environment like any normal CL library!

Errors with SBCL

SBCL by default does not ship a new enough version of ASDF, and you may encounter an error like

* (ql:quickload :alu)

debugger invoked on a ASDF/FIND-COMPONENT:MISSING-DEPENDENCY-OF-VERSION in thread
#<THREAD "main thread" RUNNING {1004E58073}>:
  Component "asdf" does not match version 3.3.5, required by #<SYSTEM "alu">

Type HELP for debugger help, or (SB-EXT:EXIT) to exit from SBCL.

restarts (invokable by number or by possibly-abbreviated name):
  0: [ABORT                  ] Give up on "alu"
  1: [REGISTER-LOCAL-PROJECTS] Register local projects and try again.
  2:                           Exit debugger, returning to top level.

(QUICKLISP-CLIENT::AUTOLOAD-SYSTEM-AND-DEPENDENCIES "alu" :PROMPT NIL)
source: (ERROR C)

If this occurs you may need to update your asdf to a newer version.

  1. Clone the repo: git clone https://gitlab.common-lisp.net/asdf/asdf.git
  2. cd asdf
  3. git checkout 3.3.5.8 (any tag in 3.3.5.* works)
  4. make
  5. In the lisp REPL: (load "/path/to/asdf/build/asdf.lisp")
  6. put (load "/path/to/asdf/build/asdf.lisp") in your ~/.sbclrc
  7. rerun the command that triggered the error