Skip to content

Instructions for adding a new language to glot.io

Petter Rasmussen edited this page May 22, 2017 · 6 revisions

Adding a new language

There are three different repositories involved in adding a new language. To make it easier to add new languages it is not required to compile and test your changes to the below repositories, you could potentially add a new language using only the github editor. Don't worry if you make a mistake in the pull request, new languages will be tested and any mistakes will be corrected before deployment. Good luck.

A docker image which has the compiler / interpreter for the new language has to be added. Using an official or a well maintained image as the baseimage is recommended. For languages that don't have a good baseimage, a distro of your choice can be used, but try to keep the image size small. A glot user and the code-runner binary has to be added to the image, see example below how to do this.

The code-runner runs inside the docker image and compiles and runs code for the given language. A run function has to be added. The function receives a list of filepaths to all the files that is to be run, and returns stdout, stderr and any errors. Most compilers / interpreters only need to know about the first file. See simple example below or more advanced examples in the repository.

To add the language to the glot.io website a handful of function clauses has to be added to Model/Language.hs. If a svg logo is available it can be put into the static/img/ folder. A png with 380px width can also be added, this is used for open graph meta tags, etc. The png can be created from the svg using this command: rsvg-convert -w 380 language.svg -o language.svg.png. See example below.

Examples