MAD - Introduction

In this series of posts we’ll look at one of the less widely known languages available on MTS - MAD, or the Michigan Algorithm Decoder.

The MAD language

Originally developed in 1959 at UM for the IBM 704, MAD is an imperative language influenced by ALGOL. It was implemented for a number of mainframes and operating systems in the 1960s, including MIT’s CTSS where it was used to develop MAIL and RUNOFF.


GOM, or Good Old MAD, is the version available on the MTS D6.0 distribution. It is a re-implementation of MAD for the IBM S/360 with some changes to the language to bring it up to date. It was used to write the messaging system on MTS.

There was also a complete redesign of MAD called MAD/I, but this is not available on D6.0 due to copyright reasons.


No special installation instructions to get GOM running - just do the standard D6.0 setup as described in this guide and then sign on as a regular user such as ST01.

Compiling using *GOM

*GOM will read source from scards (by default *source* ie standard input) and will write object files to spunch (by default the temporary file -load).

Other *GOM parameters are listed in the GOM manual.

Hello world

Here’s a terminal log of how to compile and run a simple hello world program. This assumes the source code is in file hello.mad. Note that comments are introduced with a * in column 1; all other statements (apart from line labels) must not start in column 1 but otherwise indentation is not important.

# $list hello.mad
       1     * HELLO WORLD PROGRAM
       2          LOOP FOR I=1, 1, I > 5
       3               PRINT COMMENT "Hello, world!"
       4          END LOOP
       5          END OF PROGRAM
# $run *gom scards=hello.mad
  No errors in MAIN 
# $run -load
  Hello, world!
  Hello, world!
  Hello, world!
  Hello, world!
  Hello, world!

Further information

The Wikipedia article is a good overview of the language and its implementations. An article on the MTS Archive gives more background on the history of MAD.

The GOM manual can be downloaded in PDF format from the UM Deepblue archive or the original FORMAT source can be found on the D6.0 distribution tapes under component 659/22 (restore to eg file GOMMAN.WF and then $run *format sprint=-print, copy -print *print* to get an ASCII text copy). This describes the language in detail and how it differs from MAD.

An interesting book from 1962 by one of the designers of MAD, Bernard Galler, is “The Language of Computers” which can be found at Bitsavers. This takes a number of problems and describes from first principles how these can be turned into algorithms and how we might come up with a computer language to express them - and over the course of the book elegantly explains MAD.

Eric S Raymond has produced a transpiler (MAD to C) that runs on Unixes - source code can be found at gitorious.


comments powered by Disqus