Running the Ampersand compiler
If you want to check your script, generate documentation, generate prototypes or use any other feature of Ampersand, you need to run the Ampersand compiler. This page tells you how.
In many situations, you can avoid running the Ampersand compiler from the command line. For instance, by using a system such as RAP. However, in situations that you run Ampersand from the command line, this page is the place to be.
We assume you have
dockerrunning on your computer and that you are connected to the internet. In that case you don't have to install anything.
The following is the base command on Linux (works for bash as well as zsh)
docker run -it -v $(pwd):/scripts ampersandtarski/ampersand
On the Windows-10 command-line this looks slightly different (todo: check this!)
docker run -it -v $PWD:/scripts ampersandtarski/ampersand
This runs the Ampersand compiler (from your command prompt). The first time you do this, docker will take some time to download the images it needs.
docker run -it -v "$(pwd)":/scripts ampersandtarski/ampersand COMMAND [OPTIONS] FILE
In the sequel we will use
ampersandas an alias for
docker run -it -v "$(pwd)":/scripts ampersandtarski/ampersand
ampersandtakes a file as input. It must contain a valid ampersand script, i.e. a script that complies to the syntax and semantics of ampersand. The compiler will not generate any output unless the script is valid.
The standard behavior of
ampersandis affected by the following environment variables.
- CCdbName Sets the name of the database that is to be generated. Can be overruled by --dbName
- CCdirOutput Sets the default output directory for generated assets. Can be overruled by --outputDir
- CCdirPrototype Sets the default directory where functional prototypes are being generated. Can be overruled by --proto
ampersand documentation --format docx --verbose Hawaii.adl # generates a specification document for Hawaii.adl
ampersand check Delivery.adl # just check Delivery.adl for errors
ampersand proto --proto-dir "D:\htdocs\CvM\" Contracts.adl # generate a prototype from Contracts.adl and write the application to the specified directory.
ampersand --help --verbose
In case the Ampersand compiler is called by software and fails, it is useful to have an exit code to give some information about the nature of the failure. The Ampersand compiler produces the following exit codes: