Sign inSign up

dorbmon2112/dml

By dorbmon2112

•Updated about 1 year ago

DML docker image. DML is built by Seclab, Stony Brook.

Image
Security
Languages & frameworks
0

862

dorbmon2112/dml repository overview

⁠Installing and Running DML (Discrete Math Language)

⁠What is DML?

DML is a programming language that has been custom designed for teaching discrete math. It offers several operators and constructs unavailable in typical languages, such as quantification and boolean formula satisfaction checking. While DML's syntax for these new constructs closely matches the notation used in discrete math texts, it aims for syntactic consistency with existing languages (specifically, Python) for the concepts that are already included in these languages. Here are some examples of DML formulas:

  • Generate the set of positive even numbers under 100:
{x for x in 0..100 if x % 2 = 0}
  • Check if a boolean formula is always true:
valid (x->y) || (y->z) || (z->x)
  • Generate the list of prime numbers below 1000:
{ x for x in 2..1000 if forall (y in 2..(x-1)) x % y != 0 }

The DML language is described in a separate document. This document is only about its installation and use.


⁠Installation

Although students tend to work on several platforms, including MacOS, Windows and Linux, DML runs only on Ubuntu Linux. In order to allow it to be run across all these platforms, DML has been packaged into a Docker⁠ container. Docker packages the DML system together with the underlying Linux environment into a self-contained application that you can download and run.

⁠Steps
  1. Create a folder for DML code Create a folder named dmlhome in your home directory. This is the only folder on your computer that will be shared with the DML container. It provides the sole means for moving files between your laptop and the DML container. Some of the features of DML will not work without this shared folder, so don't skip this step.

  2. Install Docker Check if docker is installed:

docker --version

If not found:

sudo snap install docker
# or
sudo apt install docker.io
  1. Download and setup the DML container Check docker is running:
docker stats

Download DML image:

docker pull dorbmon2112/dml:latest

Create the container:

  • Mac/Linux
docker create -it -v ~/dmlhome:/home/ubuntu --ulimit stack=1610612736:1610612736 --name dml -- dorbmon2112/dml:latest
  • Windows
docker create -it -v %userprofile%/dmlhome:/home/ubuntu --ulimit stack=1610612736:1610612736 --name dml -- dorbmon2112/dml:latest

⚠️ Pay attention to spaces after -- in the command.

  1. Updating the DML container To update:
docker stop dml; docker rm dml; docker pull dorbmon2112/dml:latest

Then recreate with the same docker create command as above.


⁠Running DML

Start the container:

docker start -i dml

You will get a prompt like ubuntu@container:~$.

  • Run DML directly: dml
  • Or start shell: dmlsh (recommended, supports history, editing, completion).

To exit:

  • quit or Ctrl+D exits DML
  • Ctrl+D again exits the container

⁠Running DML Commands

Press Tab for available commands. For full docs, see lang.pdf⁠. Example session:

dml> {x for x in 0..100 if x % 2 = 0}
{0, 2, 4, ..., 100}

dml> valid (x->y) || (y->z) || (z->x)
true

dml> { x for x in 2..1000 if forall (y in 2..(x-1)) x % y != 0 }
{2, 3, 5, 7, 11, ... 997}

⁠Importing Files into the Container

DML uses ~/dmlhome on your system.

  • Windows: C:\Users\your-username-here\dmlhome
  • Mac: Finder → Go → Home → dmlhome
  • Linux: cp file ~/dmlhome/

Inside container it appears as /home/ubuntu. Syncing is two-way.

List files inside container:

ls

⁠Troubleshooting

  1. Error: container name already in use
docker rm dml
  1. Cannot connect to Docker daemon Run Docker manually:
  • Windows:
start "C:\Program Files\Docker\Docker\Docker Desktop.exe"
  • Mac:
open -a Docker
  • Linux:
dockerd

(May require sudo.)

Tag summary

Content type

Image

Digest

sha256:46ac5069b…

Size

151.7 MB

Last updated

about 1 year ago

docker pull dorbmon2112/dml