Sign inSign up

wkarpiel/mercury

By wkarpiel

•Updated about 1 month ago

Compiler for the Mercury programming language

Image
Languages & frameworks
0

946

wkarpiel/mercury repository overview

Mercury⁠ language is cool, but getting started is surprisingly difficult. For most setups, you'll have to compile the compiler yourself.

Here is a container image that just works

TAG=latest
HOST_DIR=/tmp/hello
mkdir -p $HOST_DIR
cat > "$HOST_DIR/hello.m" << 'EOF'
:- module hello.
:- interface.
:- import_module io.
:- pred main(io::di, io::uo) is det.
:- implementation.

main(!IO) :-
    io.write_string("Hello, world! I was compiled inside a container!\n", !IO).
EOF

echo "Compiling the program"
docker run --rm -v "$HOST_DIR":/var/tmp/mercury:z docker.io/wkarpiel/mercury:$TAG --linkage static -m hello 
echo "Executing compiled program"
$HOST_DIR/hello

Check out the Mercury Crash Course⁠.


For simple programs, you can use below script as a drop-in replacement of mmc

#!/bin/sh

docker run \
  --rm \
  --network=none \
  -v "$(pwd)":/var/tmp/mercury:z \
  docker.io/wkarpiel/mercury:latest \
  --linkage static \
  "$@"

Tag summary

Content type

Image

Digest

sha256:9b852735f…

Size

192.9 MB

Last updated

about 1 month ago

docker pull wkarpiel/mercury