Est. 1959 Intermediate

Michigan Algorithmic Decoder (MAD)

MAD at MIT: how the University of Michigan's fast 1959 compiler became the everyday high-level language of CTSS, the time-sharing system on which MAIL, RUNOFF and ELIZA were written.

Created by Bruce Arden, Bernard Galler and Robert Graham (University of Michigan Computing Center)

Paradigm Procedural, Imperative
Typing Static; implicit by default (undeclared variables are floating point unless NORMAL MODE IS changes it)
First Appeared 1959
Latest Version The MAD Manual, Revised Edition (1966)

The Michigan Algorithmic Decoder, better known as MAD and properly titled the Michigan Algorithm Decoder in its own manuals, was a compiled, ALGOL 58-inspired language created at the University of Michigan in 1959 by Bruce Arden, Bernard Galler and Robert Graham. It was designed for a university computing center with thousands of beginning users, and its main strength was a very fast compiler. That speed made it a good fit for MIT’s Compatible Time-Sharing System (CTSS), one of the first time-sharing systems. There it became the everyday high-level language for writing commands, tools and research programs, including the MAIL command, the RUNOFF text formatter and Joseph Weizenbaum’s ELIZA.

A note on this entry

The master list this encyclopedia follows carries the language twice, once as Michigan Algorithm Decoder and once as Michigan Algorithmic Decoder (MAD). They are the same language. The Michigan Algorithm Decoder page covers MAD’s origins at Michigan, its syntax and its DEFINE facility in detail. This page concentrates on MAD’s second home, MIT and CTSS, and draws on the CTSS documentation and program listings that MIT has put online.

History & Origins

From Ann Arbor

MAD started as an attempt to implement ALGOL 58 at the University of Michigan Computing Center. The 1966 revised manual says that ALGOL 58 “was used as a pattern for this language” and that “the original translating program was written in 1959 for an IBM 704 computer with 8192 words of core storage.” Its authors wrote in Datamation in December 1961 that it had been in operation since February 1960. Michigan staff then wrote translators for the IBM 709, 7090 and 7094. The Michigan Algorithm Decoder page tells that part of the story.

To Cambridge

MIT and Michigan both ran large IBM 7090-class machines, and their computing centers exchanged software. Tom Van Vleck, who entered MIT in 1961, recalls in the CTSS 50th-anniversary overview that the introductory programming course used FORTRAN in his freshman year, but that by his sophomore year MIT had installed MAD “and was using that in most places that a compiler language was needed, especially computer courses.”

The MIT Computation Center staff learned MAD from the people who built it. Marjorie Merwin-Daggett, who with Robert Daley was one of Fernando Corbató’s two initial collaborators on CTSS, recalled going to Michigan for three or four days to take a course on MAD from Arden, Graham and Galler. MIT had some large programs that pushed MAD to its limits. When problems came up, the Michigan team didn’t have much time to help, and the interview with her says that, as a result, she “learned a lot of programs that used MAD”.

Into time-sharing

CTSS was first demonstrated on MIT’s IBM 709 in November 1961. Its central idea was compatibility: the time-sharing system would run the same languages that the Computation Center’s batch system, the FORTRAN Monitor System, already supported. The 1963 Programmer’s Guide lists them as “Fap, Mad, and Fortran in the form of the nearly equivalent Madtran”. FORTRAN itself was not available interactively. As Van Vleck later explained, it “was a hairy multipass compiler and would have required deep source changes to make it work in CTSS.” MAD did not have that problem.

The guide’s preface thanks “Professor Bernard Galler, Mr. Bruce Arden, and Mr. Robert Graham” for “advising us on the use of their Mad Compiler in our time-sharing system”, and Robert Rosin for “the Madtran editing program for processing Fortran II subprograms to Mad subprograms.”

Design Philosophy

A compiler built to be embedded

Two choices made at Michigan suited MAD to time-sharing. The first was speed. MAD’s authors aimed for “an extremely rapid translator”, because in a teaching environment most programs are compiled many times and run only briefly. On a shared machine where every user waits for the compiler, the same reasoning applies even more strongly.

The second was packaging. According to the 1966 manual, the translator was “originally included in the University of Michigan Executive System (UMES), but its construction as a subroutine has permitted its inclusion in a number of different operating systems.” CTSS relied on this. Van Vleck describes the foreground MAD command as mostly “identical to the background MAD compiler on the FMS system tape”. MIT added a wrapper to handle command-line options and replaced the input and output routines so that the compiler read and wrote disk files instead of tape and sent error messages to the user’s terminal.

Fast enough to compete with assembler

Operating systems of the early 1960s were almost always written in assembly language. CTSS was no exception: its supervisor was written almost entirely in FAP, the 7094 assembler. MAD was the exception inside the exception. Van Vleck writes that one supervisor module, the scheduler, “was written in the MAD language, in order to make repeated experimentation with the scheduling algorithm possible and safe,” and that about half of the CTSS command programs were written in MAD.

Key Features

The language itself is described in the Michigan Algorithm Decoder entry. This section looks at it the way CTSS programmers used it, through the program listings that survive from CTSS backup tapes made in 1970 and 1972.

Reading real CTSS MAD

This excerpt is from the MAD source of the CTSS MAIL command, as last modified on 17 March 1969 by R. Roach. It checks that the file to be mailed is small enough and readable before sending it:

FSTATE.(A(1),A(2),Z(7)...8)
LTH = Z(7)

WHENEVER LTH.G.432
PRFULL.(RX,A(1)...2,$ MUST BE LESS THAN 1 RECORD LONG.'B$)
     CHNCOM.(0)
     VECTOR VALUES RX = $'R'X'8$
OR WHENEVER Z(6).A.10K.NE.0.OR.Z(6).A.20K.NE.0.AND.Z.A.777777K.NE.ME
     PRFULL.(RX,A(1)...2,$''S MODE PREVENTS READING.'B$)
     CHNCOM.(0)
END OF CONDITIONAL

OPEN.($R$,A(1),A(2))
RDFILE.(A(1),A(2),1,BUFF(432)...LTH)
CLOSE.(A(1),A(2))

Most of MAD’s characteristic features show up in these few lines:

  • Function calls end with a period. FSTATE., PRFULL., OPEN. and RDFILE. are calls into the CTSS subroutine library, written exactly as a MAD program would call one of its own functions.
  • The block conditional. WHENEVER ... OR WHENEVER ... END OF CONDITIONAL is MAD’s multi-way branch.
  • Dotted operators. .G. (greater than), .NE., .OR. and .AND. are relational and Boolean operators, and .A. is the full-word bitwise AND that the 1966 manual lists with .V. (or), .EV. (exclusive or), and the shifts .LS. and .RS..
  • Octal constants. An integer followed by K, such as 777777K, is octal. That was convenient on a 36-bit machine where system data was packed into bit fields.
  • Alphabetic constants. Text between dollar signs, such as $R$, is a constant of up to six characters packed into one word. The 'B, 'R and similar sequences inside the PRFULL. messages appear to be escape codes for terminal output; they are not part of the language itself.
  • Block notation. BUFF(432)...LTH uses MAD’s notation for a region of storage. The 1966 manual says the form A...B “is usually interpreted as the entire region from A to B”, and the CTSS library used it to pass buffers.
  • VECTOR VALUES presets an array, here the message prefix RX, at compile time.

The CTSS listings also use conventions that do not appear in the 1966 Michigan manual, such as comment lines beginning with .. and an INSERT FILE statement that RUNOFF uses to pull in a shared block of PROGRAM COMMON declarations. These appear to be MIT’s own additions to the language, made to suit a disk-based system.

Library packages

The 1966 manual describes three ready-made definition packages built with the DEFINE facility, loaded with INCLUDE MATRIX, INCLUDE DOUBLE PRECISION or INCLUDE COMPLEX. They add vector and matrix arithmetic, double-precision arithmetic and complex arithmetic to a program as if their source cards had been inserted at that point.

Evolution

MADTRAN: FORTRAN through the MAD compiler

Since FORTRAN could not run in the CTSS foreground, MIT ran it through MAD. The madtrn command, documented in the 1963 guide, took a “pseudo-Fortran II language file”, edited it into an equivalent MAD file and then chained directly into the mad command. The guide even mentions this chaining as the example use of a supervisor call. For CTSS users, FORTRAN was in effect a front end for the MAD compiler.

Tuning MAD for time-sharing

The CTSS scheduler favored small programs with short run times, and MAD programmers learned to work with it. Peter Denning, a member of Project MAC from 1964 to 1968, recalled that the standard input-output library, “borrowed verbatim from Fortran”, made CTSS programs too long for the scheduler to treat well. He wrote a bare-bones replacement for MAD users called MADIO. By his own account it cut the size of his programs by 80 percent and gave them very fast response times, and it became popular in the CTSS community. That is his recollection of his own programs, not a measured benchmark. Denning also recalled learning from Al Scherr how to build a preprocessor that extended MAD into a simulation language.

The road not taken: MAD on Multics

When Project MAC planned Multics, CTSS’s successor, MAD was an obvious candidate for its system language. MIT’s Multics history records that PL/I was chosen in 1964, and that the alternatives were “a port of MAD or a port of AED-0.” Doug McIlroy, who was on the PL/I design team, recalled the comparison this way: “MAD fully existed”, but it “would have taken a lot of extension, and I don’t recall anyone offering to do the work.” The Multicians glossary notes that Henry Ancona worked on a design for a Multics MAD compiler, but it was never implemented.

The decision had a cost in speed. Van Vleck recalls that the first EPL (Early PL/I) compiler, run on CTSS, took all afternoon to compile a program of a few hundred lines, and that “EPL compilations were far slower than MAD on the same system.” That is a qualitative comparison from memory, made on an overloaded time-sharing system.

After CTSS

CTSS was retired in 1973. The 50th-anniversary overview gives May 1973 for the Project MAC system and 20 July 1973 for the day Roger Roach shut the last machine down, and MAD’s MIT role ended with it. At Michigan the language had already moved on, to the System/360 redesign MAD/I and later to GOM (“Good Old MAD”) under the Michigan Terminal System. These are covered on the Michigan Algorithm Decoder page.

Current Relevance

MAD is a historical language, but the CTSS environment it ran in can be used again:

  • CTSS listings. MIT’s CTSS documents site publishes assembler and compiler listings of the CTSS supervisor and commands, recovered by Paul Pierce and Paul Green from backup tapes made in 1970 and 1972. About two hundred distinct files in them are MAD program listings, by a count of their MAD PROGRAM LISTING headers, including MAIL and RUNOFF. They are among the largest bodies of real-world MAD code that survive.
  • Emulation. Dave Pitts’ IBM 7094 simulator, a substantial rewrite of a 7090 simulator by Paul Pierce, runs CTSS. The 50th-anniversary overview notes that users can “log in, execute commands, and compile and run MAD and FAP programs.”
  • ELIZA restored. In January 2025 Rupert Lane, Anthony Hay, Arthur Schwarz, David M. Berry and Jeff Shrager reported that they had found an original ELIZA printout in Weizenbaum’s papers, including nearly all of the MAD-SLIP code and support functions in MAD and FAP, and had brought it back to life on a restored CTSS running on an emulated 7094.
  • A modern translator. Outside emulation, Eric S. Raymond’s mad compiler translates MAD into C. Version 1.0 was released in 2010 and version 1.3 in March 2026.

Why It Matters

  • It made a high-level language practical for interactive use. CTSS’s designers could not make FORTRAN work interactively, but MAD’s speed and its design as a subroutine let them offer a compiled high-level language at the terminal from the start. MAD also stood in for FORTRAN through MADTRAN.
  • Early systems programming in a high-level language. Saying that half of CTSS’s commands and part of its supervisor were written in MAD sounds ordinary today. In the early 1960s, when operating systems were written almost entirely in assembler, it was unusual.
  • Its programs outlasted it. RUNOFF led to the roff family of text formatters, MAIL was an early electronic mail command, and ELIZA is still the most famous early chatbot. All three were first written in MAD on CTSS.
  • It trained a generation of system builders. People who wrote MAD at MIT include Van Vleck, who went on to Multics, Denning, who went on to operating-system performance research, and Kernighan, who went on to Unix.

Even the language’s famous joke has a CTSS footnote. Van Vleck recalls that when a compilation failed, the compiler “used to print out a line printer portrait of Alfred E. Neumann”, and that MIT took it out to save paper.

Sources

Timeline

1959
The original MAD translator is written at the University of Michigan for an IBM 704 with 8,192 words of core storage, using ALGOL 58 as a pattern
1960
MAD goes into operation at Michigan in February 1960, according to a December 1961 Datamation article by Arden, Galler and Graham
1963
MIT Press publishes The Compatible Time-Sharing System: A Programmer's Guide. It documents the CTSS commands mad and madtrn, and it thanks Galler, Arden and Graham for advice on using their compiler in the time-sharing system
1964
Jerome Saltzer writes RUNOFF, the CTSS text formatter, in MAD; the earliest-dated modules in the surviving source listing carry the comment 'J. H. SALTZER, NOVEMBER, 1964', and later modules are dated as late as December 1965
1964
PL/I is chosen as the implementation language for Multics. According to MIT's Multics history, the other options considered were a port of MAD or a port of AED-0
1965
Tom Van Vleck and Noel Morris write the CTSS MAIL command in MAD; it is added to CTSS in August 1965
1966
Joseph Weizenbaum's ELIZA, written in MAD-SLIP on CTSS, is described in Communications of the ACM in January. The same year, the MAD Manual is reissued in a revised edition prepared by Elliott Organick
1973
The last CTSS machine is shut down on 20 July 1973, according to Tom Van Vleck's caption in the 50th-anniversary overview (the same booklet also says the Project MAC system was shut off in May 1973), ending MAD's principal role at MIT
2011
The CTSS 50th Anniversary Commemorative Overview, edited by David Walden and Tom Van Vleck, notes that Dave Pitts' IBM 7094 simulator runs CTSS and can compile and run MAD programs
2025
The 'ELIZA Reanimated' paper (arXiv, 12 January 2025) reports restoring ELIZA from a recovered MAD-SLIP listing on a restored CTSS running on an emulated IBM 7094

Notable Uses & Legacy

CTSS command programs

MAD was the high-level language of MIT's Compatible Time-Sharing System. Tom Van Vleck writes that about half the CTSS command programs were written in MAD, and that one module of the supervisor, the scheduler, was written in MAD so that the scheduling algorithm could be changed and tested safely

RUNOFF

Jerome Saltzer's RUNOFF, which formatted and right-justified memorandum files on CTSS, was a MAD program; the oldest modules in its surviving source are dated November 1964, and the 50th-anniversary overview says Saltzer wrote it in 1963 and 1964. Its descendants include the roff family of Unix text formatters

MAIL

The CTSS MAIL command, written in MAD by Tom Van Vleck and Noel Morris in the summer of 1965, delivered a file into the mailboxes of other users on the same machine

ELIZA

Joseph Weizenbaum's ELIZA was written in MAD-SLIP, his SLIP list-processing package hosted in MAD, with support routines in MAD and FAP, and ran on CTSS

Teaching at MIT

According to Tom Van Vleck, MIT's introductory course used FORTRAN in 1961, but by the following year MAD was being used in most places a compiler language was needed, especially computer courses. Brian Kernighan learned to program in MAD during a 1966 summer job at Project MAC

Language Influence

Influenced By

ALGOL 58 GAT

Influenced

MAD/I GOM

Running Today

Run examples using the official Docker image:

docker pull
Last updated: