cowlark.com

[Home] [Index] [About] [Mail me]


Keywords
programming
my own work

Links in this document
[TXT]README
[BIN]core_030.zip
[BIN]dos16030.zip
[BIN]dos32030.zip
[BIN]linux030.zip
[BIN]posix030.zip
[BIN]core_021.zip
[BIN]dos16021.zip
[BIN]dos32021.zip
[BIN]linux021.zip
[BIN]posix021.zip

Mercat

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.

[TXT]README (5700 bytes)
The README file from the distribution, should you require more information.

Features include:

  • Garbage collection
  • Portable binary files
  • C-like syntax
  • Associative arrays as a primitive type
  • Real strings
  • Easily expandable through a simple, fast system call interface
  • Self-hosted; the compiler and assembler are written in Mercat
  • Text screen interface through ncurses

Supported platforms:

  • DOS, 16-bit (compiled with Borland C)
  • DOS, 32-bit (compiled with DJGPP)
  • Linux
  • Any other Posix system

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:

[BIN]core_030.zip (105412 bytes)
The core Mercat code, version 0.3.0.

plus one of these, depending on your platform:

[BIN]dos16030.zip (43467 bytes)
DOS 16-bit run-time binaries for version 0.3.0. Because this runs entirely in real mode, memory is extremely limited, but it will recompile the compiler.
[BIN]dos32030.zip (47439 bytes)
DOS 32-bit run-time binaries for version 0.3.0.
[BIN]linux030.zip (16501 bytes)
Linux-ELF-glibc run-time binaries for version 0.3.0.

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

[BIN]posix030.zip (41232 bytes)
Posix run-time sources for version 0.3.0. Will build any version.

Example programs and documentation are provided in the core file.


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

[BIN]core_021.zip (68649 bytes)
[BIN]dos16021.zip (35483 bytes)
[BIN]dos32021.zip (40431 bytes)
[BIN]linux021.zip (12838 bytes)
[BIN]posix021.zip (36069 bytes)

All material © 2000-2002 David Given, unless where stated otherwise.
This page last updated on 2002-09-21 16:55:55.000000000 +0100 mercat.ns .