This repository contains the base Dockerfiles used for compiling and running SaC programs.
Pre-built Docker images are available on Docker Hub.
This Docker image provides everything needed to compile and run Single Assignment C (SaC) programs. You do not need to install SaC on your computer.
We recommend using Docker from a terminal rather than using the Docker Desktop graphical interface. The commands below are all you need.
From inside the folder where your SaC files are located, run:
docker run -it --rm \
-v "$PWD:/home" \
sacbase/sac-compiler:latestYou are now inside the SaC environment.
Your current directory on your computer (PWD) is now available under /home.
Important: Run all SaC programs from inside this Docker environment. The compiled programs need the SaC runtime libraries, which are installed in the container.
-itgives you an interactive terminal inside the container.--rmautomatically removes the container when you exit. Files in the mounted directory are not removed.-v "$PWD:/home"mounts your current directory as/homeinside the container. Files you create there are therefore stored on your computer.sacbase/sac-compiler:latestspecifies the Docker image to use.
You can create an alias so you don't have to type the full Docker command every time:
alias saccompiler='docker run -it --rm -v "$PWD:/home" sacbase/sac-compiler:latest'You can then start the SaC environment with:
saccompilerThe alias only lasts for the current terminal session.
To make it permanent, add the alias command to your shell's configuration file, such as ~/.bashrc or ~/.zshrc.
Inside the container:
sac2c program.sac
./a.outThe source files and generated files are stored in your normal directory on your computer because it is mounted as /home.
When you are done:
exitThe Docker container is automatically removed. Files in the mounted directory are not deleted.
This Docker image provides a ready-to-use Jupyter Notebook environment for SaC. You do not need to install SaC or Jupyter on your computer.
We recommend using Docker from a terminal rather than using the Docker Desktop graphical interface. The commands below are all you need.
From inside the folder where you want to store your notebooks, run:
docker run --rm -p 8888:8888 \
-v "$PWD:/home/jovyan/work" \
sacbase/sac-jupyter-notebook:latestJupyter will start and print in the console a URL containing a login token, for example:
http://127.0.0.1:8888/tree?token=...
Open that URL in your web browser.
--rmautomatically removes the container when you exit. Files in the mounted directory are not removed.-p 8888:8888makes Jupyter's port 8888 available on your computer.-v "$PWD:/home/jovyan/work"mounts your current directory as theworkdirectory inside the container. Files you create there are therefore stored on your computer.sacbase/sac-jupyter-notebook:latestspecifies the Docker image to use.
You can create an alias so you don't have to type the full Docker command every time:
alias sacjupyter='docker run --rm -p 8888:8888 -v "$PWD:/home/jovyan/work" sacbase/sac-jupyter-notebook:latest'You can then start Jupyter with:
sacjupyterThe alias only lasts for the current terminal session.
To make it permanent, add the alias command to your shell's configuration file, such as ~/.bashrc or ~/.zshrc.
In Jupyter, open the work directory.
Create a new notebook and select the SaC kernel. You can now write and execute SaC code directly in the notebook.
When you are done, return to the terminal running Jupyter and press:
Ctrl+C
The Docker container is automatically removed. Your notebooks and other files in the mounted directory are not deleted.
To start Jupyter again, run the command from step 1.
We generate a fresh image every week for both environments. To update the Docker image to the latest version, run:
docker pull sacbase/sac-compiler:latestTo pull or run a specific image, use sacbase/sac-compiler:yyyy-ww instead, where yyyy is the year, and ww is the week number.
A list of available versions is available on Docker Hub.