anoma / alucard

A common lisp DSL for writing zero knowledge circuits
https://anoma.github.io/alucard
18 stars 1 forks source link
blockchain zkp zkproof

Since Alu is a DSL, it's syntax is heavily inspired from it's host language [[https://common-lisp.net/][Common lisp]], extending the language with circuit compilation capabilities. This means that Alucard can use language infrastructure like [[https://fiveam.common-lisp.dev/][FiveAM]] and [[https://www.cliki.net/SWANK][SWANK]] to allow a battle tested interactive developer experience. Quick Start [[https://hackmd.io/KTN_7tyGTe2RvJ5-aC4rBw][A friendly introduction can be found here]] Documentation The most complete documentation is the [[https://hackmd.io/emeUBiYoSqmJ95Ls2wsrMQ][Alucard Reference Manual]].

For those curious about test coverage, the test coverage of the compiler can be found [[https://anoma.github.io/juvix-circuits/][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.

+begin_src lisp

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

+end_src

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 [[https://lispcookbook.github.io/cl-cookbook/vscode-alive.html][Alive]]

With [[https://lispcookbook.github.io/cl-cookbook/vscode-alive.html][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

+begin_src javascript

{ "alive.lsp.startCommand": [ "alu.image", "-a" ] }

+end_src

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 [[https://github.com/vlime/vlime][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

+begin_src lisp

;; Swank started at port: 4005.

+end_src

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

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

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

+begin_src lisp

  1. Clone the repo: =git clone https://gitlab.common-lisp.net/asdf/asdf.git=
  2. =cd asdf=
  3. =git checkout 3.3.5.8= ([[https://gitlab.common-lisp.net/asdf/asdf/-/tags][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