A compiler to translate Scilla to LLVM-IR. Scilla transitions in the generated LLVM-IR can be compiled to a shared library and executed using ScillaRTL. The project is under active development and is not intended for production use yet.
sudo apt-get update && sudo apt-get install -yq ninja-build libboost-system-dev libboost-test-dev
The Scilla compiler requires LLVM-13 to be installed on your system. Refer to https://apt.llvm.org/ on how to install LLVM-13.
wget -O - https://apt.llvm.org/llvm-snapshot.gpg.key|sudo apt-key add -
sudo apt-get update
sudo apt-get install llvm-13 clang-13
The compiler depends on Scilla base, which can be installed by following the instructions here After installing Scilla_base, run the following.
opam install ./ --deps-only --with-test --yes
To build and obtain the executables in the project's bin
directory:
make
make test
If you are using LLVM from a non-system path (because you built it
yourself, for example) then the environment variable LIBRARY_PATH
must be set to the directory that contains built LLVM libraries.
This will install the compiler binaries to your current opam switch. This step is not usually necessary to try out and use the compiler.
make install
This will uninstall Scilla compiler installed with the previous command.
make uninstall
LLVM-IR generated from this compiler can be compiled and linked into
a shared library (clang -shared
) and executed using ScillaRTL.
(If you didn't install the compiler to your opam switch, you can run the binaries directly
from the bin
directory).
Compile a full Scilla contract:
scilla-llvm -libdir src/stdlib tests/codegen/contr/simple-map.scilla -gaslimit 10000
Compile a pure Scilla expression:
expr-llvm -libdir src/stdlib tests/codegen/expr/match_assign.scilexp -gaslimit 10000
The testsuite includes both Scilla expressions and full contracts for which LLVM-IR is generated and compared against pre-generated text.
make test