Est. 1959 Intermediate

Michigan Algorithm Decoder

MAD, the University of Michigan's fast ALGOL 58-inspired compiler of 1959, which taught thousands of students to program and became the workhorse language of MIT's CTSS.

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 360/370 descendant GOM was last documented in a June 1989 manual revision

The Michigan Algorithm Decoder, almost always called MAD, was a programming language and compiler developed at the University of Michigan Computing Center in 1959 by Bruce Arden, Bernard Galler and Robert Graham. It began as an attempt to implement ALGOL 58. By the time it worked it had become its own language, and its biggest selling point was speed: MAD compiled programs fast enough that a university could let thousands of beginners submit jobs to a single IBM mainframe. In the 1960s it taught a generation of students to program at Michigan and elsewhere. It also became the main high-level language of MIT’s Compatible Time-Sharing System (CTSS), where it was used to write ELIZA and RUNOFF.

History & Origins

From IT and GAT to ALGOL 58

Michigan’s compiler work began on an IBM 650 that arrived on campus in 1956. Arden was the 650’s main operator and Graham later joined him as an operator there. Galler, a young mathematics instructor, was one of the machine’s heaviest users. The group installed Alan Perlis’s IT (Internal Translator) compiler. Then, as Galler recalled in his 1991 oral history for the Charles Babbage Institute, Arden and Graham “decided to generalize the language a little bit” and wrote GAT, the Generalized Algebraic Translator.

In 1958 the joint American-European committee published the International Algebraic Language, soon renamed ALGOL 58, and asked people to implement it so its flaws would come out. John Carr came back to Michigan saying, as Galler remembered it, “We’ve got to do an ALGOL 58.” The group took it on. Galler explained what happened next:

“By the time we designed the language that we thought would be worth doing, and we could do a compiler for, we said we couldn’t call it ALGOL any more; it really was different.”

They chose the name MAD and asked Mad magazine for permission. Galler said the magazine replied with a funny letter threatening to take them to court, ending with a P.S.: “Sure, go ahead.” The letter has since been lost.

Building the translator

Galler described a three-way split of the compiler. Graham wrote Part I (the front end), Galler wrote Part II (the tables and glue between the passes), and Arden wrote Part III (the back end). When Graham later left for the University of Massachusetts, Galler took over Part I as well.

According to the 1966 revised manual, “the original translation program was written in 1959 for an IBM 704 computer with 8192 words of core storage.” The authors’ December 1961 Datamation article says MAD had been “in operation since February, 1960”. Galler’s 1991 recollection that it “really got finally working in 1961” probably refers to the 709 version. He remembered the three authors going to New York in about February 1961 and debugging it at night on Socony Mobil’s IBM 709 so that it would be ready when Michigan’s own 709 arrived. The contemporary 1961 article is the more reliable source for the original 704 date.

Galler also recalled taking MAD to a SHARE meeting, he thought in 1960, and telling a FORTRAN session that its work was unnecessary because MAD was better and faster.

Design Philosophy

MAD was built for a specific place: a large university computing center that could not be a closed shop. Its authors put it this way in 1961:

“Like it or not, these users will work at the level of an algebraic source language—often making many compilations on programs which are not destined to become long-run production programs.”

That led to their two design goals: “an extremely rapid translator accepting a source language which has a minimum number of restrictions.” The authors admitted that allowing such general expressions sometimes produced less efficient object code than compilers for more restricted languages. A fast turnaround for many small, short-lived student programs mattered more to them than squeezing the last cycle out of a production job.

Why it was fast

The authors’ explanation of the speed comes down to tape and tables:

  • In the 709/7090 version, programs under 200 statements needed no tape movement apart from reading the source and writing the object program. The translator itself was a single record on the master tape.
  • The translator relied heavily on a few internal tables, and statement types could be recognised without a full analytic scan.
  • In Galler’s account, Graham studied IBM’s FORTRAN listings for the 704 and concluded that FORTRAN was slow largely because it searched tables on the magnetic drum, one word per drum revolution. MAD kept its tables in core and used the drum only for overflow, so it never searched the drum.

The authors also cited two measurements. On the 7090, a 785-statement compilation took one minute and produced about 10,000 machine instructions. On another occasion, running under the Bell Monitor System on the 7090, MAD compiled 84 programs in 20 minutes. These are the authors’ own figures from 1961, with no side-by-side FORTRAN timing on the same jobs. Galler’s often-quoted comparison is an anecdote: an IBM visitor was proud of finding useful work to do during the 20-second tape rewind in the middle of a FORTRAN compilation, while the whole MAD translation took about a second. Read it as his recollection, not as a benchmark.

Key Features

Program layout

MAD was a punched-card language. Columns 1-10 held an optional statement label, an R in column 11 marked a remark (comment), a digit in column 11 continued the previous card, and columns 73-80 were left for sequence numbers. Spaces had no meaning outside character constants. Names were up to six characters, a letter followed by letters or digits, so each name fitted in one 36-bit word of the IBM 704. Function names ended with a period (SQRT., FACT.).

The keywords were long English phrases such as WHENEVER, TRANSFER TO, THROUGH and END OF PROGRAM. The 1966 manual let programmers shorten them to the first and last letters joined by an apostrophe, so W'R stood for WHENEVER and E'M for END OF PROGRAM.

Modes

MAD called its data types modes. The basic modes were floating point, integer, Boolean (written 1B and 0B), statement label and function name. Variables were floating point unless declared otherwise, and NORMAL MODE IS INTEGER (or another mode) changed the default for a whole program. Alphabetic constants of up to six characters were written between dollar signs, like $ABC$, and stored as integers.

Operators

The 704’s character set had no < or ≠, so the relational and Boolean operators were written as dotted words:

MADMeaning
.L. .LE. .E. .NE. .G. .GE.relational comparisons
.AND. .OR. .NOT. .EXOR.Boolean operations
.THEN. .EQV.implication and equivalence
.ABS. .P.absolute value and exponentiation

Compound conditionals

MAD’s multi-branch WHENEVER statement was well ahead of FORTRAN’s arithmetic IF at the time. This example is from the authors’ 1961 Datamation article:

WHENEVER I .G. J .AND. X .E. 3
C(I) = B(J)
X = 2
TRANSFER TO BETA(I)
OR WHENEVER I .G. J .AND. X .E. 2
C(I) = B(J) + X
X = X - 1
OTHERWISE
C(I) = B(J) - X
X = X - 1
END OF CONDITIONAL

Eric Raymond’s notes to his transcription of the manual point out that this multi-line form anticipated the syntax of ALGOL 60’s descendants, including Pascal and C.

Iteration

The THROUGH statement repeats every statement down to a given label. It takes either a list of values, as in THROUGH A, FOR VALUES OF Q = 50, 25, 10, 5, 1, or a start value, an increment and a Boolean stopping condition. The loop variable can be of any mode, including floating point.

Functions and recursion

Internal functions were compiled as part of the program and shared its variables, which the authors compared to ALGOL procedures. External functions were compiled separately, like FORTRAN subroutines. Recursion was allowed, but the programmer had to save and restore values on a pushdown list with SAVE DATA, RESTORE DATA, SAVE RETURN and RESTORE RETURN. This is the recursive factorial from the manual (the calling program must set up the list with SET LIST TO):

            EXTERNAL FUNCTION (N)
            NORMAL MODE IS INTEGER
            ENTRY TO FACT.
            WHENEVER N .E. 0, FUNCTION RETURN 1
            SAVE RETURN
            SAVE DATA N
            T1 = FACT.(N-1)
            RESTORE DATA N
            RESTORE RETURN
            FUNCTION RETURN T1*N
            END OF FUNCTION

Because function names were themselves values, MAD programs could pass functions as arguments. The manual’s Simpson’s-rule example integrates whatever function it is handed.

Arrays and formats

Arrays could have any number of dimensions. Their dimension information was kept in an ordinary vector that could be changed while the program ran, and a programmer could even supply a custom storage-mapping function, for example to store only half of a symmetric matrix. READ DATA and PRINT RESULTS handled self-describing NAME = value input and output without any format, while READ FORMAT and PRINT FORMAT used format specifications similar to FORTRAN’s.

The DEFINE facility

The 15 November 1960 Supplement to the MAD Manual added a way to define new operators and new modes of arithmetic. The programmer gave the operator’s name, its precedence relative to an existing operator and the mode combinations it accepted, followed by IBM 704/709-style instructions that implemented it:

DEFINE BINARY OPERATOR .LOGADD., PRECEDENCE SAME AS .OR.

Galler said the facility “worked from 1961 on”, but the group was slow to publish it and regretted that later work on extensible languages seldom cited MAD. He also believed that lectures he gave in Amsterdam in the mid-1960s fed into ALGOL 68’s extensibility. That is his own account and is not confirmed elsewhere.

Evolution

Ports and dialects

The 1962 manual records the move from the 704 to the IBM 709/7090 with 32,768 words of core. The 1966 revised edition adds that the Michigan staff wrote translators for the 709, 7090 and 7094, and that “interested groups elsewhere have adapted the language for the IBM 7040, Philco 210-211, and Sperry Rand 1107 machines.” MAD was officially part of the University of Michigan Executive System (UMES). Because the translator was built as a subroutine, it could be fitted into other operating systems too: the 1961 article says it was also available under the FORTRAN Monitor System and the Bell Monitor System, and it later ran under CTSS at MIT.

According to Galler, Michigan used MAD until the middle of 1965, when the campus 7090 was retired, and he said the team found no new bugs in the compiler during its last four years. Michigan then moved to the IBM System/360 and the Michigan Terminal System (MTS). Two quite different descendants followed:

  • MAD/I was an extensible redesign for the System/360, started in the mid-1960s under the ARPA-sponsored CONCOMP project and documented in a 1970 manual. Its syntax was closer to ALGOL 60 and borrowed from PL/I. According to the GOM manual, MAD/I was ill-fated and never became practical to use.
  • GOM, for “Good Old MAD”, is described in its manual as essentially the 7090 MAD language, modified and extended for the 360/370 architecture. According to the manual, it was built because MTS needed a language for small utility programs and pieces of the operating system, and MAD was seen as a happy medium between the shortcomings of Fortran and the excesses of PL/I. GOM accepted free-form input, lines up to 255 characters, lower case and longer names, and it added character, short, byte and long integer, pointer and dynamic-record modes. Its manual reportedly names Don Boettner and Jim Sterken of the Computing Center as contacts, and the manual’s last revision is dated June 1989.

Current Relevance

MAD is a historical language. No vendor supports it, and its original platforms are long gone. It does survive in two forms:

  • Raymond’s retrocompiler. Eric S. Raymond’s mad translates MAD source into C and then calls the local C compiler. It ships with a transcription of the February 1962 manual and scans of the original. It is part of his Retrocomputing Museum and has been released at 1.0 (2010), 1.1 (2015, with many improvements by Dave Pitts), 1.2 (2024) and 1.3 (March 2026). Its documentation says it assumes a 64-bit C long to hold MAD’s 36-bit integers and does not implement the DEFINE statement. The transcribed manual’s notes say tape and drum devices are not supported, although the current source does include basic tape-file routines that map tapes to ordinary files.
  • The original compiler under emulation. Dave Pitts’ IBM 7094 emulator, based on earlier work by Paul Pierce, runs a restored CTSS that includes MIT’s version of MAD. In January 2025 the “ELIZA Reanimated” team used that environment to compile and run ELIZA from a MAD-SLIP listing recovered from Weizenbaum’s papers at MIT.

The University of Michigan’s Bentley Historical Library holds Computing Center records on MAD and MAD/I, including annotated printouts and original manuals.

Why It Matters

  • It showed that compile speed matters. MAD was designed on the principle that in a teaching environment, most programs are compiled many times and run briefly, so the compiler’s speed counts for more than the speed of the code it produces. That made it practical to give large classes of complete beginners real programming problems on one shared mainframe.
  • It was an early ALGOL 58 descendant in real use. Most ALGOL 58 implementations were short-lived. MAD was used for years, and its block WHENEVER ... OR WHENEVER ... OTHERWISE ... END OF CONDITIONAL gave programmers structured multi-way branching years before it became common.
  • It made language extension a practical feature. The DEFINE facility let ordinary programs add operators and arithmetic modes in 1960-61, long before extensible languages became a research topic.
  • It shaped early time-sharing. As a main high-level language of CTSS, MAD was used to write tools whose descendants are still running: RUNOFF led through Multics runoff to Unix roff and troff, and ELIZA was the first famous chatbot.

The language was named after a humour magazine, and widely repeated accounts say early versions printed a picture of Alfred E. Neuman on badly broken programs. But MAD’s main legacy was practical: a fast, forgiving compiler that let large numbers of beginners program a 1960s mainframe.

Timeline

1958
ALGOL 58 (the International Algebraic Language) is published with an invitation to implement it. John Carr urges the University of Michigan Computing Center to build a compiler for it, and Bruce Arden, Robert Graham and Bernard Galler take on the job
1959
The original MAD translator is written for an IBM 704 with 8,192 words of core storage. The language has drifted far enough from ALGOL 58 that the team names it the Michigan Algorithm Decoder, and Mad magazine gives them permission to use the name
1960
MAD enters service at Michigan in February 1960, according to a December 1961 Datamation article by its three authors
1960
A Supplement to the MAD Manual dated 15 November 1960 adds octal constants and the DEFINE facility, which lets a program add new operators and new modes of arithmetic to the language
1961
Arden, Galler and Graham publish 'The Internal Organization of the MAD Translator' in Communications of the ACM (vol. 4, no. 1, January 1961). It began as an invited paper at the ACM Compiler Symposium in November 1960
1961
Translators now run on the IBM 704, 709 and 7090. According to the authors, the 704 version took two man-years to write and the 709/7090 rewrite took about three man-months
1962
The MAD reference manual is issued in a February 1962 edition. Its introduction says features in the appendices exist only in the 709/7090 version
1966
The Revised Edition of the MAD Manual records ports by outside groups to the IBM 7040, Philco 210-211 and Sperry Rand 1107. The same January, Joseph Weizenbaum's CACM paper describes ELIZA, a program written in MAD-SLIP on MIT's CTSS
1981
GOM ('Good Old MAD'), a reworking of 7090 MAD for the IBM 360/370 under the Michigan Terminal System, is reportedly in use by this date; its manual is said to list the statements still unimplemented 'as of 4/20/81'
2010
Eric S. Raymond releases mad 1.0 (18 September 2010), a compiler that translates MAD into C. It ships with a transcription of the February 1962 manual
2025
The 'ELIZA Reanimated' team (arXiv, 12 January 2025) compiles a recovered MAD-SLIP listing of ELIZA with the MAD compiler on a restored CTSS running on an emulated IBM 7094
2026
Raymond's mad compiler reaches version 1.3 (19 March 2026)

Notable Uses & Legacy

University of Michigan teaching

MAD was designed for a computing center serving thousands of novice users. Its authors reported that 100 or more students in a one-semester course with no prior computer experience were set final problems in MAD such as symbolic differentiation, an interpreter for a small MAD-like language, and an assembler for a FAP-like language

MIT Compatible Time-Sharing System (CTSS)

MIT needed a fast compiler for student use on its time-sharing system and adopted MAD. Galler recalled that it served as CTSS's in-core translator for many years, and the 2025 ELIZA restoration paper calls MAD CTSS's core user-level language

ELIZA

Joseph Weizenbaum's original ELIZA was written in MAD-SLIP, his SLIP list-processing library hosted in MAD, for the IBM 7094 under CTSS. According to the restoration team, the ELIZA stack (MAD-SLIP plus support functions) runs to around 2,600 lines of mostly uncommented MAD and FAP code

RUNOFF

Jerome Saltzer's RUNOFF text formatter for CTSS was written in MAD. Doug McIlroy and Bob Morris based the BCPL version of runoff for Multics on it, and that line of tools leads to Unix roff, nroff and troff

MADTRAN

A FORTRAN-to-MAD translator written in MAD. It let FORTRAN programs go through the faster MAD compiler, and it used integer mode for every variable because MAD stored Hollerith (character) constants as integers

Language Influence

Influenced By

ALGOL 58 GAT FORTRAN

Influenced

MAD/I GOM

Running Today

Run examples using the official Docker image:

docker pull
Last updated: