[Cowlark Logo] cowlark.com

Mercat

my cross-platform programming system

Introduction

Back in 1997 I decided, more or less for the hell of it, to design and implement a programming system. Mercat, nee Micron, is that language, and this is it.

Mercat is not really useful for anything much. It is, on the other hand, an excellent example of how to implement a self-hosted recursive-descent-parsed language and virtual machine. The code is --- I hope --- reasonably easy to understand, and I think the overall design is quite elegant.

Features include:

Supported platforms:

Here's some code, taken from one of the example programs, a full-screen editor.

function void MenuInitialise
        array Menu menubar;
{
    int i;
    int j;
    int x := 1;
    int w;
    string label;

    for(i:=0; i<sizeof(menubar); i:=i+1)
    {
        menubar[i].x := x;
        w := sizeof(menubar[i].label);
        x := x + 2 + w;
        for(j:=0; j<sizeof(menubar[i].item); j:=j+1)
        {
            label := menubar[i].item[j].label;
            if (sizeof(label) > w)
                w := sizeof(label);
        }
        menubar[i].width := w;
    }
}

So you want to give Mercat a try

Because Mercat is portable, the bulk of the code is provided as platform-independent .mo files. All you need is an interpreter for your system. Therefore, you will need:

plus one of these, depending on your platform:

If you don't have any of those platforms, or want to rebuild the run-time from source, then you'll want this:

Example programs and documentation are provided in the core file.

One of the main interesting features of mercat is the bootstrap compiler, which is a full recursive-descent compiler written in... awk. Yes, really. It actually works reasonably well, although it does stretch the limits of what the language can do. For convenience, therefore, here's a direct download.


If you are of a historical bent, you might be interested in the prior Mercat version, 0.2.1.

Page last updated: 2014 April 27 © 2008-2013 David Given, unless specified otherwise