MAD programming language
Encyclopedia
MAD is a programming language
Programming language
A programming language is an artificial language designed to communicate instructions to a machine, particularly a computer. Programming languages can be used to create programs that control the behavior of a machine and/or to express algorithms precisely....

 and compiler
Compiler
A compiler is a computer program that transforms source code written in a programming language into another computer language...

 for the IBM 704
IBM 704
The IBM 704, the first mass-produced computer with floating point arithmetic hardware, was introduced by IBM in 1954. The 704 was significantly improved over the IBM 701 in terms of architecture as well as implementations which were not compatible with its predecessor.Changes from the 701 included...

 and later the IBM 709
IBM 709
The IBM 709 was an early computer system introduced by IBM in August, 1958. It was an improved version of the IBM 704 and the second member of the IBM 700/7000 series of scientific computers....

, IBM 7090
IBM 7090
The IBM 7090 was a second-generation transistorized version of the earlier IBM 709 vacuum tube mainframe computers and was designed for "large-scale scientific and technological applications". The 7090 was the third member of the IBM 700/7000 series scientific computers. The first 7090 installation...

, UNIVAC 1107
UNIVAC 1107
The UNIVAC 1107 was the first member of Sperry Rand's UNIVAC 1100 series of computers, introduced in October 1962. It was also known as the Thin Film Computer because of its use of thin film memory for its register storage...

, UNIVAC 1108, Philco 210-211, and eventually the IBM S/370 mainframe computers. Developed in 1959 at the University of Michigan
University of Michigan
The University of Michigan is a public research university located in Ann Arbor, Michigan in the United States. It is the state's oldest university and the flagship campus of the University of Michigan...

 by Bernard Galler
Bernard Galler
Bernard A. Galler was an American mathematician and computer scientist at the University of Michigan who was involved in the development of large-scale operating systems and computer languages including the MAD programming language and the Michigan Terminal System operating system.He attended the...

, Bruce Arden
Bruce Arden
Bruce W. Arden is an American computer scientist.He graduated from Purdue University with a BS in 1949 and started his computing career in 1950 with the wiring and programming of IBM's hybrid at the Allison Division of General Motors...

 and Robert M. Graham
Robert M. Graham
Robert M. Graham is a computer scientist and Professor Emeritus of Computer Science at the University of Massachusetts. He was born to a Scottish emigrant....

, MAD is a variant of the International Algebraic Language (IAL). It was widely used to teach programming at colleges and universities during the 1960s and played a minor role in the development of CTSS, Multics
Multics
Multics was an influential early time-sharing operating system. The project was started in 1964 in Cambridge, Massachusetts...

, and the Michigan Terminal System
Michigan Terminal System
The Michigan Terminal System is one of the first time-sharing computer operating systems. Initially developed in 1967 at the University of Michigan for use on IBM S/360-67, S/370 and compatible mainframe computers, it was developed and used by a consortium of eight universities in the United...

 computer operating systems
Operating system
An operating system is a set of programs that manage computer hardware resources and provide common services for application software. The operating system is the most important type of system software in a computer system...

.

The archives at the Bentley Historical Library
Bentley Historical Library
The Bentley Historical Library is a historical library located on the University of Michigan's North Campus in Ann Arbor. It was established in 1935 by the regents of the University of Michigan...

 of the University of Michigan contain reference materials on the development of MAD and MAD/I, including three linear feet of printouts with hand-written notations and original printed manuals.

MAD, MAD/I, and GOM

There are three MAD compilers:
  1. Original MAD, the compiler developed in 1959 at the University of Michigan for the IBM 704
    IBM 704
    The IBM 704, the first mass-produced computer with floating point arithmetic hardware, was introduced by IBM in 1954. The 704 was significantly improved over the IBM 701 in terms of architecture as well as implementations which were not compatible with its predecessor.Changes from the 701 included...

     and later the IBM 709
    IBM 709
    The IBM 709 was an early computer system introduced by IBM in August, 1958. It was an improved version of the IBM 704 and the second member of the IBM 700/7000 series of scientific computers....

     and IBM 7090
    IBM 7090
    The IBM 7090 was a second-generation transistorized version of the earlier IBM 709 vacuum tube mainframe computers and was designed for "large-scale scientific and technological applications". The 7090 was the third member of the IBM 700/7000 series scientific computers. The first 7090 installation...

     mainframe
    Mainframe computer
    Mainframes are powerful computers used primarily by corporate and governmental organizations for critical applications, bulk data processing such as census, industry and consumer statistics, enterprise resource planning, and financial transaction processing.The term originally referred to the...

     computers running the University of Michigan Executive System
    University of Michigan Executive System
    The University of Michigan Executive System, or UMES, a batch operating system developed at the University of Michigan in 1958, was widely used at many universities...

     (UMES) and the Compatible Time-Sharing System (CTSS) operating system
    Operating system
    An operating system is a set of programs that manage computer hardware resources and provide common services for application software. The operating system is the most important type of system software in a computer system...

    s. In the mid-1960s MAD was ported at the University of Maryland
    University of Maryland
    When the term "University of Maryland" is used without any qualification, it generally refers to the University of Maryland, College Park.University of Maryland may refer to the following:...

     to the UNIVAC 1108. Versions of MAD were also available for the Philco
    Philco
    Philco, the Philadelphia Storage Battery Company , was a pioneer in early battery, radio, and television production as well as former employer of Philo Farnsworth, inventor of cathode ray tube television...

     210-211 and UNIVAC 1107
    UNIVAC 1107
    The UNIVAC 1107 was the first member of Sperry Rand's UNIVAC 1100 series of computers, introduced in October 1962. It was also known as the Thin Film Computer because of its use of thin film memory for its register storage...

    .
  2. MAD/I, an "extended" version of MAD for the IBM S/360 series of computers running under the Michigan Terminal System
    Michigan Terminal System
    The Michigan Terminal System is one of the first time-sharing computer operating systems. Initially developed in 1967 at the University of Michigan for use on IBM S/360-67, S/370 and compatible mainframe computers, it was developed and used by a consortium of eight universities in the United...

     (MTS). Work on the new compiler started in 1965 as part of the ARPA
    Defense Advanced Research Projects Agency
    The Defense Advanced Research Projects Agency is an agency of the United States Department of Defense responsible for the development of new technology for use by the military...

     sponsored CONCOMP project at the University of Michigan. As work progressed it gradually became clear that MAD/I was a new language independent of the original 7090 version of MAD.
  3. GOM (Good Old MAD), a reimplementation of the original 7090 MAD for the IBM S/370 series of mainframe computers running the Michigan Terminal System
    Michigan Terminal System
    The Michigan Terminal System is one of the first time-sharing computer operating systems. Initially developed in 1967 at the University of Michigan for use on IBM S/360-67, S/370 and compatible mainframe computers, it was developed and used by a consortium of eight universities in the United...

     (MTS). GOM was created in the early 1980s by Don Boettner at the University of Michigan Computing Center.

History

MAD is a variant of the International Algebraic Language (IAL). IAL is the original name for what eventually became ALGOL 58
ALGOL 58
ALGOL 58, originally known as IAL, is one of the family of ALGOL computer programming languages. It was an early compromise design soon superseded by ALGOL 60...

. While MAD was motivated by ALGOL 58, it does not resemble ALGOL 58 in any significant way.

Programs written in MAD included MAIL, RUNOFF
RUNOFF
RUNOFF was the first computer text formatting program to see significant use. It was written in 1964 for the CTSS operating system by Jerome H. Saltzer in MAD assembler....

, one of the first text processing systems, and several other utilities all under Compatible Time-Sharing System(CTSS). Work was done on a design for a MAD compiler for Multics
Multics
Multics was an influential early time-sharing operating system. The project was started in 1964 in Cambridge, Massachusetts...

, but it was never implemented.

The following is an interesting quote from An Interview with Brian Kernighan
Brian Kernighan
Brian Wilson Kernighan is a Canadian computer scientist who worked at Bell Labs alongside Unix creators Ken Thompson and Dennis Ritchie and contributed to the development of Unix. He is also coauthor of the AWK and AMPL programming languages. The 'K' of K&R C and the 'K' in AWK both stand for...

when he was asked "What hooked you on programming?":
I think that the most fun I had programming was a summer job at Project MAC at MIT in the summer of 1966, where I worked on a program that created a job tape for the brand new GE 645 in the earliest days of Multics. I was writing in MAD, which was much easier and more pleasant than the FORTRAN and COBOL that I had written earlier, and I was using CTSS, the first time-sharing system, which was infinitely easier and more pleasant than punch cards.


MAD was quite fast compared to some of the other compilers of its day. Because a number of people were interested in using the FORTRAN
Fortran
Fortran is a general-purpose, procedural, imperative programming language that is especially suited to numeric computation and scientific computing...

 language and yet wanted to obtain the speed of the MAD compiler, a system called MADTRAN (written in MAD) was developed. MADTRAN was simply a translator from FORTRAN to MAD, which then produced machine code. MADTRAN was distributed through SHARE
SHARE (computing)
SHARE Inc. is a volunteer-run user group for IBM mainframe computers that was founded in 1955 by Los Angeles-area IBM 701 users. It evolved into a forum for exchanging technical information about programming languages, operating systems, database systems, and user experiences for enterprise users...

.

MAD/I has a syntactic structure similar to ALGOL 60
ALGOL 60
ALGOL 60 is a member of the ALGOL family of computer programming languages. It gave rise to many other programming languages, including BCPL, B, Pascal, Simula, C, and many others. ALGOL 58 introduced code blocks and the begin and end pairs for delimiting them...

 together with important features from the original MAD and from PL/I
PL/I
PL/I is a procedural, imperative computer programming language designed for scientific, engineering, business and systems programming applications...

. MAD/I was designed as an extensible language. It was available for use under MTS
Michigan Terminal System
The Michigan Terminal System is one of the first time-sharing computer operating systems. Initially developed in 1967 at the University of Michigan for use on IBM S/360-67, S/370 and compatible mainframe computers, it was developed and used by a consortium of eight universities in the United...

 and provided many new ideas which made their way into other languages, but MAD/I compilations were slow and MAD/I never extended itself into widespread use when compared to the original 7090 MAD.

GOM is essentially the 7090 MAD language modified and extended for the 360/370 architecture with some judicious tailoring to better fit current programming practices and problems. The MTS
Michigan Terminal System
The Michigan Terminal System is one of the first time-sharing computer operating systems. Initially developed in 1967 at the University of Michigan for use on IBM S/360-67, S/370 and compatible mainframe computers, it was developed and used by a consortium of eight universities in the United...

 Message System was written in GOM.

MAD, MAD Magazine, and Alfred E. Neuman

In a pre-release version of the original MAD, as a reference to MAD's namesake, MAD magazine, when a program contained too many compile time errors the compiler would print a full-page picture of Alfred E. Neuman
Alfred E. Neuman
Alfred E. Neuman is the fictional mascot and cover boy of Mad magazine. The face had drifted through American pictography for decades before being claimed and named by Mad editor Harvey Kurtzman...

 using ASCII art
ASCII art
ASCII art is a graphic design technique that uses computers for presentation and consists of pictures pieced together from the 95 printable characters defined by the ASCII Standard from 1963 and ASCII compliant character sets with proprietary extended characters...

. The caption read, "See this man about your program--He might want to publish it. He never worries--but from the looks of your program, you should." This feature was not included in the final official version.

And Bernie Galler remembers:
By the time we designed the language that we thought would be worth doing and for which we could do a compiler, we couldn't call it Algol any more; it really was different. That's when we adopted the name MAD, for the Michigan Algorithm Decoder. We had some funny interaction with the Mad Magazine people, when we asked for permission to use the name MAD. In a very funny letter, they told us that they would take us to court and everything else, but ended the threat with a P.S. at the bottom - "Sure, go ahead." Unfortunately, that letter is lost.

"Hello, world" example

The "hello, world" example program prints the string "Hello, world" to a terminal or screen display.

PRINT FORMAT HELLOW
VECTOR VALUES HELLOW=$13h0Hello, world*$
END OF PROGRAM

The first character of the line is treated as logical carriage control, in this example the character zero which causes a double spaced line to be printed.

Or, if entering all of the keywords at your keypunch is too much work, you can use contractions and the compiler will expand them in the listing:

P'T HELLOW
V'S HELLOW=$13h0Hello, world*$
E'M

Input format

MAD programs are a series of statements written on punched cards, generally one statement per card, although a statement can be continued to multiple cards. Columns 1-10 contains an optional statement label, comments or remarks are flagged using the letter "R" in column 11, and columns 73-80 are unused and could contain a sequence identifier. Spaces are not significant anywhere other than within character constants. For GOM input is free form with no sequence field and lines may be up to 255 characters long; lines that start with an asterisk (*) are comments; and lines that start with a plus-sign (+) are continuation lines.

Names

Variable names, function names, and statement labels have the same form, a letter followed by zero to five letters or digits. Function names end with a period. All names can be subscripted (the name followed by parentheses, with multiple subscripts separated by commas). For GOM names may be up to 24 characters long and may include the underscore (_) character.

Few keywords in the language are reserved words since since most are longer than six letters or are surrounded by periods. There is a standard set of abbreviations which can be used to replace the longer words. These consist of the first and last letters of the keywords with an apostrophe between them, such as W'R for WHENEVER and D'N for DIMENSION.

Data types

MAD uses the term "mode" for its data types. Five basic modes are supported:
  • Integer written with or without a scale factor (1, +1, -1, 1K10, 1K) or as octal constants (to 7777777777777K);
  • Floating Point written with or without an exponent (0., 1.5, -0.05, +100.4, -4., .05E-2, -.05E2, 5E02, 5.E2);
  • Boolean (1B for true and 0B for false);
  • Statement Label, and
  • Function Name written as a name followed by a period (SQRT.).


The mode of a constant can be redefined by adding the character M followed by a single digit at the end of the constant, where 0 indicates floating point, 1 integer, 2 boolean, 3 function name, and 4 statement label.

For GOM six additional modes are added: CHARACTER, SHORT INTEGER, BYTE INTEGER, LONG INTEGER, POINTER, and DYNAMIC RECORD.

Alphabetic or character constants are stored as integers and written using the dollar sign as a delimiter ($ABCDEF$) with double dollar-signs used to enter a true dollar sign ($$$.56$ is 56 cents). Strings longer than six characters are represented using arrays.

Arrays and matrices

  • There is no limit on the number of dimensions.
  • Negative and zero as well as floating-point subscripts are allowed.
  • Matrices are storied in consecutive memory locations in the order determined by varying the rightmost subscript first.
  • Matrices may be referenced using a subscript for each dimension, NAME(s1,s2,s3), or using a single subscript, NAME(s1).
  • Input-output lists, VECTOR VALUES statements, and some subroutines allow the use of block notation, which has the form A,...,B or A...B, which is a reference to the entire region from A to B. inclusive. In terms of a vector, A(1)...A(N) would be A(1), A(2), A(3), ..., A(N).
  • There are facilities that allow changing dimensions at run-time; permitting the programmer to vary the location of the initial element in an array within the overall block which has been set aside for the array; and allowing an arbitrary storage mapping to be specified.

Arithmetic operators

  • .ABS. (unary absolute value)
  • + (unary identity)
  • - (unary negation)
  • + (addition)
  • - (subtraction)
  • * (multiplication)
  • / (division)
  • .P. (exponentiation)
  • .N. (bitwise negation)
  • .A. (bitwise and)
  • .V. (bitwise or)
  • .EV. (bitwise exclusive or)
  • .LS. (left shift)
  • .RS. (right shift)
  • .REM. (remainder, GOM only)

Pointer operators (GOM only)

  • : (selection)
  • .LOC. (location)
  • .IND. (indirection)


Relational operators

  • .L. (less than)
  • .LE. (less than or equal)
  • .E. (equal)
  • .NE. (not equal)
  • .G. (greater than)
  • .GE. (greater than or equal)

Boolean operators

  • .NOT. (unary logical not)
  • .OR. (logical or)
  • .EXOR. (logical exclusive or)
  • .AND. (logical and)
  • .THEN. (implies)
  • .EQV. (equivalence)

Bit operators (GOM only)

  • .SETBIT. (set bit to 1)
  • .RESETBIT. (reset bit to 0)
  • .BIT. (test bit)


Declaration statements

Variables may be implicitly or explicitly declared. By default all implicitly declared variables are assumed to be floating point. The NORMAL MODE IS statement may be used to change this default.
  • FLOATING POINT var1, var2, ... (may include dimension information)
  • INTEGER var1, var2, ... (may include dimension information)
  • BOOLEAN var1, var2, ... (may include dimension information)
  • FUNCTION NAME name1, name2, ... (may include dimension information)
  • STATEMENT LABEL label1, label2, ... (may include dimension information)
  • MODE NUMBER n, var1, var2, ... (may include dimension information)
  • NORMAL MODE IS type-name (INTEGER, BOOLEAN, FLOATING POINT, STATEMENT LABEL, or FUNCTION NAME)
  • NORMAL MODE IS MODE NUMBER n
  • DIMENSION variable(max-dimension) (declares an array from 0...max-dimension)
  • DIMENSION variable(from...to)
  • DIMENSION variable((subscript1, subscript2, ..., subscriptn) (declares a multidimensional array)

  • VECTOR VALUES array(n) = c1, c2, c3, ...
  • VECTOR VALUES array(m) ... array(n) = constant
  • DOUBLE STORAGE MODE mode-list (doubles the amount of storage allocated for the modes listed)
  • EQUIVALENCE (a1, a2, ..., am), ...
  • PROGRAM COMMON a, b, c, ... (may include dimension information)
  • ERASABLE a, b, c, ... (may include dimension information)
  • PARAMETER A1<(B1/sub>), A2(B2), ..., An(Bn)
  • SYMBOL TABLE VECTOR variable
  • FULL SYMBOL TABLE VECTOR variable
  • LISTING ON (the default)
  • LISTING OFF
  • REFERENCES ON
  • REFERENCES OFF (the default)


Executable statements

  • variable = expression (assignment)
  • TRANSFER TO statement-label
  • WHENEVER boolean-expression, executable-statement (simple conditional)
  • WHENEVER boolean-expression (compound conditional)
    • OR WHENEVER boolean-expression
    • OTHERWISE
    • END OF CONDITIONAL
  • CONTINUE (do nothing statement, usually used to carry a statement label)

  • THROUGH statement-label, FOR VALUES OF variable = expression-list (iteration)
  • SET LIST TO array-element, [ expression ]
  • SAVE DATA list
  • RESTORE DATA list
  • PAUSE NO. octal-integer (stop execution, print an octal number on the operators console, allow manual restart)
  • END OF PROGRAM (the last statement in all MAD programs)


Input and output statements

  • READ DATA (reads data using a self-defining format, var1=value1, var2=value2, ..., varN=valueN
  • READ AND PRINT DATA (similar to READ DATA, but data read is echoed to the printer)
  • READ FORMAT format, list
  • READ BCD TAPE n, format, list
  • READ BINARY TAPE n, list
  • PRINT RESULTS list
  • PRINT BCD RESULTS list
  • PRINT OCTAL RESULTS list
  • PRINT COMMENT $string$ (first character of string is carriage control)
  • PRINT FORMAT format, list
  • PRINT ON LINE FORMAT format, list (display a message for the machine operator)
  • WRITE BCD TAPE n, format, list
  • WRITE BINARY TAPE n, list

  • PUNCH FORMAT format, list
  • LOOK AT FORMAT format, list (read data without advancing to next record)
  • REWIND TAPE n
  • END OF FILE TAPE n
  • BACKSPACE RECORD OF TAPE n
  • BACKSPACE RECORD OF TAPE n, IF LOAD POINT TRANSFER TO statement
  • BACKSPACE FILE OF TAPE n
  • BACKSPACE FILE OF TAPE n, IF LOAD POINT TRANSFER TO statement
  • SET LOW DENSITY TAPE n
  • SET HIGH DENSITY TABLE n
  • REWIND TAPE n
  • UNLOAD TAPE n
  • FORMAT VARIABLE list (declaration, may include dimension information)


Functions

Function names end with a period. Internal and external functions are supported. Internal functions are compiled as part of the program in which they are used and share declarations and variables with the main program. External functions are compiled separately and do not share declarations and variables. A one statement definition of internal functions is permitted. Recursive functions are permitted, although the function must do some of the required saving and restoring work itself.
  • INTERNAL FUNCTION function-name.(argument-list) = expression (single statement definition)
  • INTERNAL FUNCTION function-name.(argument-list)
  • EXTERNAL FUNCTION function-name.(argument-list)
  • ENTRY TO NAME name.
  • END OF FUNCTION (last statement in a multiple line definition)
  • FUNCTION RETURN [ expression ]

  • ERROR RETURN (force an error return to a statement or to the operating system, if no error statement is given as last argument of the call)
  • SAVE RETURN
  • RESTORE DATA
  • RESTORE RETURN
  • EXECUTE procedure.(argument-list) (call a non-single valued function)

Operator definition and redefinition

One of the most interesting features in MAD is the ability to extend the language by redefining existing operators, defining new operators, or defining new data types (modes). The definitions are made using MAD declaration statements and assembly language mnemonics included following the declaration up to the END pseudo-instruction that implement the operation.
  • DEFINE BINARY OPERATOR defined-op, PRECEDENCE rank existing-op MODE STRUCTURE mode-options
  • DEFINE UNARY OPERATOR defined-op, PRECEDENCE rank existing-op MODE STRUCTURE mode-options
  • MODE STRUCTURE mode-no = mode-no existing-op mode-no
  • MODE STRUCTURE mode-no = mode-no existing-op mode-no SAME SEQUENCE AS mode-no existing-op mode-no


where:
  • rank is one of SAME AS, LOWER THAN, or HIGHER THAN; and
  • mode-options are the options that appear on the MODE STRUCTURE statement.


Three pre-defined packages of definitions (MATRIX, DOUBLE PRECISION, and COMPLEX) are available for inclusion in MAD source programs using the INCLUDE statement.
  • INCLUDE package

External links

The source of this article is wikipedia, the free encyclopedia.  The text of this article is licensed under the GFDL.
 
x
OK