This repository contains the code for SAWScript, the scripting language that forms the primary user interface to the Software Analysis Workbench (SAW). It provides the ability to reason about formal models describing the denotation of programs written in languages such as C, Java, and Cryptol.
The SAWScript tutorial, [doc/tutorial/] (https://github.com/GaloisInc/saw-script/raw/master/doc/tutorial), gives an introduction to using the SAWScript interpreter.
Precompiled SAWScript binaries for a variety of platforms are available on the releases page.
To build SAWScript and related utilities (CSS, LSS, JSS) from source:
-
Ensure that you have the Stack program on your
PATH. If you don't already have Stack, thencabal install stack, or download a precompiled binary from https://github.com/commercialhaskell/stack/releases. -
Ensure that you have the C libraries and header files for
terminfo, which generally comes as part ofncurseson most platforms. -
Ensure that you have the programs
javacandz3on yourPATH. Z3 binaries are available at https://github.com/Z3Prover/z3/releases -
Developers: optionally, create a
build-sandbox-version-pins.txtand pin the revisions of dependencies as necessary by adding lines like<dependency name> <committish>See the
pinfunction inbuild-sandbox.shfor more details. The release branches already include a known-to-workbuild-sandbox-versions-pins.txt, so you can get a stable build by checking out a release branch (e.g.git checkout release-0.2).To create a
build-sandbox-versions-pins.txtfor the current state of the dependencies, dofor d in deps/*; \ do (cd $d && echo -n "$(basename "$d") "; git rev-parse HEAD); \ done > build-sandbox-version-pins.txtand then
git add --force build-sandbox-version-pins.txtif you are in a new release branch.
-
Setup a
stack.yamlfor your OS and preferred GHC.Choose one of the Stack YAML config files and link it to
stack.yaml:ln -s stack.<ghc version and os>.yaml stack.yamlThe
stack-<ghc version>-unix.yamlfiles are for both Linux and OS X.(Alternatively, you can
export STACK_YAML=stack.<ghc version and os>.yamlinstead of creating a symlink.
Developers: defining a
STACK_YAMLenv var also overrides thestack.yamlfile, if any, and so is useful for testing a alternative build without permanently changing your default. You can even defineSTACK_YAMLonly for the current command: e.g.STACK_YAML=stack.<ghc version and os>.yaml stack buildwill build SAWScript using the given Stack YAML.)
-
Build SAWScript by running
./build-sandbox.sh -pThe
-pflag tells it to pull the latest updates from any dependency repositories. You can omit-p, and speed up the build slightly, if you know that they haven't changed.The SAWScript executables will be created in
echo `stack path --local-install-root`/bina path under the SAWScript repo. You can install SAWScript into a more predictable location by running
stack installwhich installs into
stack path --local-bin-pathwhich is
$HOME/.local/binby default. -
Optionally, run ./stage.sh to create a binary tarball.
Many dependencies are automatically downloaded into deps/ when you
build using build-sandbox.sh; see
Manual Installation above. Key automatically
downloaded dependencies include:
deps/cryptol-verifier/: Cryptol Symbolic Simulator (CSS)deps/jvm-verifier/: Java Symbolic Simulator (JSS)deps/llvm-verifier/: LLVM Symbolic Simulator (LSS)deps/saw-core/: SAWCore intermediate language, used by CSS, JSS, LSS and SAWScriptdeps/cryptol/: Cryptoldeps/abcBridge/: Haskell bindings for ABC