Getting started with Plasma
version 0.1, March 10, 2019
Since we don’t have static builds yet, you’ll need to build Plasma from source. This file contains some instructions on setting up the prerequisites and buidling Plasma.
You’ll need another language, Mercury, since our compiler is written in it. Version 14.01.1 or newer is required but an ROTD version is recommended since the stable release is quite old and may be less compatible with newer C compilers. An ROTD version is required for musl-based systems.
Compiling Mercury from source can take a long time, but if you’re on Debian, Ubuntu or other derivative running on x86_64 then there are some packages! Read on or follow the instructions at https://dl.mercurylang.org/deb/
For Ubuntu 18.04, this is what you need to do:
You’ll need a basic C and C++ build environment. That can be installed with the build-essential:
sudo apt install build-essential
Next install the repo where you can find the packages, They’re signed with Paul’s gpg key, so you’ll need to tell apt to trust things signed by it:
cd /tmp wget https://paul.bone.id.au/paul.asc sudo apt-key add paul.asc
Create a new file in /etc/apt/sources.list.d, name it mercury.list and paste in it:
deb http://dl.mercurylang.org/deb/ stretch main deb-src http://dl.mercurylang.org/deb/ stretch main
sudo apt update sudo apt install mercury-rotd-recommended
If all goes well you now have a working version of Mercury on your computer.
To optionally build the documentation, you want to install AsciiDoc:
sudo apt install asciidoc
Beware, this is a very large installation, on a default Ubuntu installation this amounts to over 1 GB of space and a download of over 300MB. If AsciiDoc is not installed, documentation will not be built.
If you want to run Plasma in a Docker container, this Dockerfile could help:
WORKDIR /src RUN wget http://dl.mercurylang.org/rotd/mercury-srcdist-rotd-2018-11-12.tar.gz RUN tar zxf mercury-srcdist-rotd-2018-11-12.tar.gz WORKDIR /src/mercury-srcdist-rotd-2018-11-12 RUN apk add binutils build-base bison flex git asciidoc linux-headers RUN ./configure --enable-minimal-install RUN make RUN make install WORKDIR /src RUN git clone https://github.com/PlasmaLang/plasma.git WORKDIR /src/plasma RUN make RUN make test
The rotd version of Mercury could probably be more recent, depending on when you are reading this. Note that this is just for running Plasma programs, not for hacking on Plasma itself. The minimal install of mercury doesn’t allow for debugging the Plasma compiler.
Now it’s time to clone the plasma repo:
git clone https://github.com/PlasmaLang/plasma.git
If you want or need to, you can configure Plasma’s build settings by editing the Makefile. The Makefile itself contains documentation that explains the build options. These include which C compiler to use, and compilation flags. The default build is reasonable if you have gcc.
Then run make and it will build you the plasma compiler (src/plzc) and the runtime (runtime/plzrun)
The make test command will execute the test suite. Be sure to take a look at the example programs in examples/.
If you’re stuck and the Documentation doesn’t contain the answer or clue you need or you’re struggling to find it. Please ask for help. The Contact page of the website lists all the ways you can get in touch. In particular the Plasma Help mailing list and IRC channel are the best resources for help.
For bugs or missing information please file a bug.
If you want to write some Plasma programs and you use vim. You may wish to use the vim editor support.