Download 1.0

From Mesham
Jump to navigationJump to search


Mesham compiler 1.0
Icon:
{{{caption}}}
Description: The latest release of the Mesham compiler
Version: 1.0.0_411
Released: August 2013
Author: Nick Brown
Website: http://www.mesham.com

Introduction

This is the latest version of the Mesham compiler and is based upon the language as described here and documented on this website. The compiler has been entirely rewritten from scratch and this line of compiler (version 1.0 and upwards) is known as at the Oubliette line to distinguish it from the previous versions.

Version 1.0.0 is currently an alpha release and as such should be considered experimental. Please keep checking back for later versions which will be released as we fix bugs and add features.

The Mesham compiler and runtime library are compatible with x86 (64 and 32 bit) Linux only, if you wish to use Mesham on a Windows operating system then you will need to download an older version.

Download

  • All components (compiler, runtime library, libgc) - download 64 bit here and 32 bit here
  • Latest compiler version: 1.0.0_411 released 16th August 2013 - download 64 bit here and 32 bit here
  • Latest runtime library version: 1.0.03 released 16th August 2013 - download 64 bit here and 32 bit here
  • Experimental thread based runtime library version: 1.0.03 released 16th August 2013 - download 64 bit here and 32 bit here
  • Conservative garbage collector (libgc) version 7.2 - download 64 bit here and 32 bit here

If you are unsure whether you are running under a 32bit or 64bit system, then issue uname -m, the result of x86-64 means 64 bit, any other value such as i686 is 32 bit.

Prerequisites

In order to run and compile Mesham code you need to have an implementation of MPI (version 3) and a C compiler. We suggest MPICH and GCC which are available in source form, binary form or most systems make them available via their package manager (i.e. apt-get.) Refer to your system documentation for the best way to get these packages if you do not already have them installed.

If you are using the experimental thread based runtime library then MPI is not required, the thread based RTL uses pthreads which is usually already installed.

Installation Instructions

Whilst it is a manual installation procedure, the good news is that this is very simple and will be elementary to anyone familiar with Linux.

It is suggested to download all components which will provide you with the compiler, runtime library and libgc. Unpack the archive and place the mcc (whihc is the main compiler) executable in your chosen location. It is suggested to either add the location to your path environment variable or add a symbolic link from the /usr/bin directory to the mcc binary so that you can call it regardless of the working directory.

Next we need to set up some environment variables to tell the compiler exactly where to find some different aspects. We can set these via the command export varible=value where variable is the name of the environment variable you wish to set and value is the value to set it to. The first environment variable, MESHAM_C_COMPILER, decides which C compiler to use - we suggest mpicc and if you agree then issue export MESHAM_C_COMPILER=mpicc.

Next we are going to set MESHAM_SYS_INCLUDE which points to the Mesham system include files (supplied with the compiler and all archive in the includes directory.) Set this variable to point to the directory containing these .mesh files. MESHAM_C_INCLUDE needs to point to the directory containing the mesham.h header file and will be used by the C compiler. This, along with the runtime library, is supplied in the rtl directory. Lastly, the MESHAM_C_LIBRARY should point to the directory containing the Mesham runtime library and also the libgc library (this can be in the same directory or you can separate the values the via ;.) It it suggested to add these exports to your .bashrc script to avoid excessive typing.

An optional environment variable is the MESHAM_C_COMPILER_ARGS variable, which allows for specific flags to be provided to the underlying C compiler on each run regardless of the Mesham code or explicit user command line arguments. This is useful to apply certain machine specific optimisations.

If you do not wish to set these last two environment variables then alternatively you can symlink libmesham.so and libgc.so into your /usr/lib directory and the mesham.h header file into /usr/include.

Now we have done this we are good to go; issue mcc -env which will display the environment variables.

Testing the compiler

Copy the following code into test.mesh, then compile via mcc -e test.mesh (the -e flag will display any errors reported by the C compiler.) All being well an executable test will appear, run this via mpiexec -np 1 ./test after ensuring your favourite MPI process manager is running.

#include <io>
#include <string>
#include <parallel>

function void main() {
   group 0,1,2,3 {
      print("Hello from process "+itostring(pid())+"\n");
   };
};

All being well, you should see the output (but the order of the lines will vary):

Hello from process 0
Hello from process 2
Hello from process 3
Hello from process 1