Implementation Hierarchy

Next: , Previous: The Idea Behind Types, Index: Index

Although not essential to the programmer, it is quite useful to know the basics of how the implementation hierachy works. When constructing the compiler there have been a number of aims

  • Simple to compile
  • Executable simple to run
  • Portable
  • Run on multi-core machines



  • The core translator produces ANSI standard C99 C code which uses the Message Passing Interface (version 2) for communication. Therefore, on the target machine, an implementation of MPI, such as OpenMPI, MPICH or a vendor specific MPI is required and will all work with the generated code. Additionally our runtime library (known as LOGS) needs to be also linked in. The runtime library performs two roles - firstly it is architecture specific (and versions exist for Linux, Windows etc..) as it contains any none portable code which is needed and is also optimised for specific platforms. Secondly the runtime library contains functions which are often called and would increase the size of generated C code.

    The resulting executable can be thought of as any normal executable, and can be run in a number of ways. In order to allow for simplicity the user can execute it by double clicking it, the program will automatically spawn the number of processors required. Secondly the executable can be run via the mpi deamon, and may be instigated via a process file or queue submission program. It should be noted that, as long as your MPI implementation supports multi-core (and the majority of them do) then the code can be executed properly on a multi core machine, often with the processes wrapping around the cores (for instance 2 processes on 2 cores is 1 process on each, 6 processes on 2 cores is 3 processes on each etc...)

    The translator in more detail


    The translator itself is contained within a number of different phases. Firstly, your Mesham code goes through a preprocessor, written in Java, which will do a number of jobs, such as adding scoping information. When this is complete it then gets sent to the translation server - from the design of FlexibO, the language we wrote the translator in, the actual translation is performed by a server listening using TCP/IP. This server can be on the local machine, or a remote one, depending exactly on the setup of your network. Once translation has completed, the generated C code is sent back to the client via TCP/IP and from there can be compiled. The most important benefit of this approach is flexibility - most commonly we use Mesham via the command line, however a web based interface also exists, allowing the code to be written without the programmer installing any actual software on their machine.

    Last Modified: August 2008