We provide commands and scripts that will allow you to both quickly generate code from the examples, and compile and execute that generated code.
$ git clone https://github.com/phou/STLab.git
$ cd STLab
$ make
$ make installYou should now have a HsScribble executable in your present working directory.
All example protocols can be found in the
STLab/scribble directory.
To generate Scala code from a given Scribble file, Protocol.nuscr, it suffices
to run the command:
$ HsScribble -f scribble/Protocol.nuscr -eThis will generate a new file: scala/Protocol.scala.
For example, running
$ HsScribble -f scribble/EVoting.nuscr -ewill result in the output:
Input file name: scribble/EVoting.nuscr
Output Directory: scala/
and will produce scala/EVoting.scala.
Other optional flags are available and can be seen by running:
$ HsScribble -hThe resulting generated code can be found in scala/ directory.
To compile and run generated Scala code, e.g. scala/Protocol.scala, run the
runScala.sh script:
$ ./runScala.sh scala/Protocol.scalaThis will run the Scala build tool sbt using the provided build.sbt
configuration file. Generated code includes a number of print statements that
are designed to illustrate the communications behaviour of the given example.
The first time runScala is used, sbt may take additional time to fetch
dependencies and compile the Effpi library.