Movatterモバイル変換


[0]ホーム

URL:


Jump to content
WikipediaThe Free Encyclopedia
Search

MAD (programming language)

From Wikipedia, the free encyclopedia
Historical programming language

MAD
Paradigmprocedural,imperative,structured
FamilyALGOL
Designed byBernard Galler,Bruce Arden,Robert M. Graham
DeveloperUniversity of Michigan
First appeared1959; 66 years ago (1959)
Typing disciplineStatic,strong
ScopeLexical
OSUMES,MTS,CTSS, others
Majorimplementations
IBM 704,7090,S/360,S/370;UNIVAC 1108;Philco 210-211
Dialects
MAD, MAD/I, GOM
Influenced by
IAL, ALGOL 58

MAD (Michigan Algorithm Decoder) is aprogramming language andcompiler for theIBM 704 and later theIBM 709,IBM 7090,IBM 7040,UNIVAC 1107,UNIVAC 1108,Philco 210-211, and eventuallyIBM System/370mainframe computers. Developed in 1959 at theUniversity of Michigan byBernard Galler,Bruce Arden andRobert M. Graham, MAD is a variant of theALGOL language. It was widely used to teach programming at colleges and universities during the 1960s and played a minor role in the development ofCompatible Time-Sharing System (CTSS),Multics, and theMichigan Terminal System computeroperating systems.[1] The original version of thechatbotELIZA was written inMAD-SLIP.[2]

The archives at theBentley Historical Library 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.[3][4][5][6]

MAD, MAD/I, and GOM

[edit]

Three MAD compilers exist:

  1. OriginalMAD, the compiler developed in 1959 at the University of Michigan for theIBM 704 and later theIBM 709 andIBM 7090mainframe computers running theUniversity of Michigan Executive System (UMES) and theCompatible Time-Sharing System (CTSS)operating systems.[7][8] In the mid-1960s MAD was ported at theUniversity of Maryland to theUNIVAC 1108.[9] Versions of MAD were also available for thePhilco 210-211 andUNIVAC 1107.[9]
  2. MAD/I, an "extended" version of MAD for theIBM System/360 series of computers running under theMichigan Terminal System (MTS). Work on the new compiler started in 1965 as part of theARPA 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.[10]
  3. GOM (Good Old MAD), a reimplementation of the original 7090 MAD for theIBM System/370 series of mainframe computers running theMichigan Terminal System (MTS). GOM was created in the early 1980s by Don Boettner at the University of Michigan Computing Center.[11][12]

History

[edit]

WhileMAD was motivated byALGOL 58, it does not resemble ALGOL 58 in any significant way.[13][14]

Programs written in MAD included MAIL,[15]RUNOFF,[16] one of the first text processing systems, and several other utilities all underCompatible Time-Sharing System (CTSS).[17] Work was done on a design for a MAD compiler forMultics, but it was never implemented.[18]

The following is an interesting quote fromAn Interview withBrian Kernighan[19] when he was asked "What hooked you on programming?":

I think that the most fun I had programming was a summer job atProject 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 theFORTRAN 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 throughSHARE.[13]

MAD/I has a syntactic structure similar toALGOL 60 together with important features from the original MAD and fromPL/I.[10] MAD/I was designed as an extensible language. It was available for use underMTS 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.[12]

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.[12] TheMTS Message System was written in GOM.

MAD, Mad magazine, and Alfred E. Neuman

[edit]
Line printer output following a MAD compiler error on an IBM 704 computer at the University of Michigan, c. 1960

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 ofAlfred E. Neuman usingASCII art. 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."[9] This feature was not included in the final official version.[20] However, it was included in the production version for the IBM 7040.

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 anymore; 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.[21]

"Hello, world" example

[edit]

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

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

The first character of the line is treated aslogical carriage control, in this example the character "0" which causes a double-spaced line to be printed.

Alternatively, contractions can be used, and the compiler will expand them in the listing:

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

Language elements

[edit]

MAD and GOM, but not MAD/I, are composed of the following elements:[8][12][13]

Input format

[edit]

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

[edit]

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 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

[edit]

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 (to7777777777777K);
  • 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 and0B 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, andDYNAMIC 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

[edit]
  • 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.
List of operators, statements, and functions

Operators

[edit]

Arithmetic operators

[edit]
  • .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)

[edit]
  • : (selection)
  • .LOC. (location)
  • .IND. (indirection)

Relational operators

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

Boolean operators

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

Bit operators (GOM only)

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

Declaration statements

[edit]

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 NAMEname1,name2, ... (may include dimension information)
  • STATEMENT LABELlabel1,label2, ... (may include dimension information)
  • MODE NUMBERn, var1, var2, ... (may include dimension information)
  • NORMAL MODE IStype-name (INTEGER, BOOLEAN, FLOATING POINT, STATEMENT LABEL, or FUNCTION NAME)
  • NORMAL MODE IS MODE NUMBERn
  • DIMENSIONvariable(max-dimension) (declares an array from 0...max-dimension)
  • DIMENSIONvariable(from...to)
  • DIMENSIONvariable(subscript1,subscript2, ...,subscriptn) (declares a multidimensional array)
  • VECTOR VALUESarray(n) = c1, c2, c3, ...
  • VECTOR VALUESarray(m) ...array(n) = constant
  • DOUBLE STORAGE MODEmode-list (doubles the amount of storage allocated for the modes listed)
  • EQUIVALENCE (a1,a2, ...,am), ...
  • PROGRAM COMMONa,b,c, ... (may include dimension information)
  • ERASABLEa,b,c, ... (may include dimension information)
  • PARAMETERA1(B1),A2(B2), ...,An(Bn)
  • SYMBOL TABLE VECTORvariable
  • FULL SYMBOL TABLE VECTORvariable
  • LISTING ON (the default)
  • LISTING OFF
  • REFERENCES ON
  • REFERENCES OFF (the default)

Executable statements

[edit]
  • variable =expression (assignment)
  • TRANSFER TOstatement-label
  • WHENEVERboolean-expression,executable-statement (simple conditional)
  • WHENEVERboolean-expression (compound conditional)
    • OR WHENEVERboolean-expression
    • OTHERWISE
    • END OF CONDITIONAL
  • CONTINUE (do nothing statement, usually used to carry a statement label)
  • THROUGHstatement-label, FOR VALUES OFvariable =expression-list (iteration)
(wherevariable may be any mode including floating-point)
  • SET LIST TOarray-element, [expression ]
  • SAVE DATAlist
  • RESTORE DATAlist
  • 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

[edit]
  • 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 FORMATformat,list
  • READ BCD TAPEn,format,list
  • READ BINARY TAPEn,list
  • PRINT RESULTSlist
  • PRINT BCD RESULTSlist
  • PRINT OCTAL RESULTSlist
  • PRINT COMMENT $string$ (first character of string is carriage control)
  • PRINT FORMATformat,list
  • PRINT ON LINE FORMATformat,list (display a message for the machine operator)
  • WRITE BCD TAPEn,format,list
  • WRITE BINARY TAPEn,list
  • PUNCH FORMATformat,list
  • LOOK AT FORMATformat,list (read data without advancing to next record)
  • REWIND TAPEn
  • END OF FILE TAPEn
  • BACKSPACE RECORD OF TAPEn
  • BACKSPACE RECORD OF TAPEn, IF LOAD POINT TRANSFER TOstatement
  • BACKSPACE FILE OF TAPEn
  • BACKSPACE FILE OF TAPEn, IF LOAD POINT TRANSFER TOstatement
  • SET LOW DENSITY TAPEn
  • SET HIGH DENSITY TABLEn
  • REWIND TAPEn
  • UNLOAD TAPEn
  • FORMAT VARIABLElist (declaration, may include dimension information)

Functions

[edit]

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 FUNCTIONfunction-name.(argument-list) =expression (single statement definition)
  • INTERNAL FUNCTIONfunction-name.(argument-list)
  • EXTERNAL FUNCTIONfunction-name.(argument-list)
  • ENTRY TO NAMEname.
  • 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
  • EXECUTEprocedure.(argument-list) (call a non-single valued function)

Operator definition and redefinition

[edit]

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 OPERATORdefined-op, PRECEDENCErankexisting-op MODE STRUCTUREmode-options
  • DEFINE UNARY OPERATORdefined-op, PRECEDENCErankexisting-op MODE STRUCTUREmode-options
  • MODE STRUCTUREmode-no =mode-noexisting-opmode-no
  • MODE STRUCTUREmode-no =mode-noexisting-opmode-no SAME SEQUENCE ASmode-noexisting-opmode-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.

  • INCLUDEpackage

See also

[edit]

Notes

[edit]
  1. ^Alt, Franz (1967).Advances in Computers.Academic Press. p. 143.ISBN 0-12-012104-2.
  2. ^Shrager, Jeff."Joseph Weizenbaum's Original ELIZA". Archived fromthe original on August 13, 2021. RetrievedJanuary 12, 2023.
  3. ^Technical Memos, University of Michigan Computing Center publications, 1965-1999
  4. ^Technical Reports, University of Michigan Computing Center publications, 1965-1999
  5. ^Topical File 1960-1986, University of Michigan Computing Center records, 1952-1996
  6. ^MAD (Michigan Algorithm Decoder) 1960-1979, University of Michigan Computing Center records, 1952-1996
  7. ^A User's Reference Manual For The Michigan Algorithm Decoder (MAD) For the IBM 7090, Digital Computer Laboratory, Graduate College, University of Illinois, 1962, 221 pages
  8. ^abThe Michigan Algorithm Decoder (The MAD Manual), Bruce W. Arden, Revised Edition 1966
  9. ^abcGeorge Gray (June 2002)."UNIVAC and ALGOL".Unisys History Newsletter.6 (2). Archived fromthe original on June 29, 2017.
  10. ^abThe MAD/I Manual, Bolas, Springer, and Srodawa, CONCOMP Technical Report 32, 1970, University of Michigan, Ann Arbor, 194 pages
  11. ^MTS Volume 2: Public File Descriptions, University of Michigan Computing Center, 1990, p. 14
  12. ^abcdGOM Manual, Don Boettner, University of Michigan Computing Center, Ann Arbor, June 1989
  13. ^abcComputer Languages - Principles and History
  14. ^In August 2010 when asked about Jean's Sammet's statement that "MAD does not resemble ALGOL 58 in any significant way", Bruce Arden wrote: "Regarding Jean Sammet, she may have conflated the two versions of IAL (58 and60). Unlike the later version, the 58 version said nothing about what words (or language) should be used to identify conditional and transfer statements, which led for parsing reasons to words like WHENEVER. Also there were some additional features in MAD that went beyond the 58 specs."
  15. ^Documentation and Source for Early Electronic Mail and Messaging, Tom Van Vleck
  16. ^"... Doug McIlroy and Bob Morris wrote Multics runoff in BCPL based on Jerry Saltzer's MAD version of RUNOFF for CTSS.","Multics Software Features: Section 1.7.7", Multicans Web site. Retrieved November 10, 2018.
  17. ^Compatible Time-Sharing System (1961-1973): Fiftieth Anniversary Commemorative Overview, David Walden and Tom Van Vleck (Eds), 2011, IEEE Computer Society. Retrieved November 10, 2018.
  18. ^"Glossary of Multics acronyms and terms", Tom Van Vleck, Multicans Web site.
  19. ^Noren, Allen (April 10, 2009)."An Interview with Brian Kernighan: Breeding Little Languages".O'Reilly Community. Archived fromthe original on June 30, 2017. RetrievedJuly 28, 2023.
  20. ^Shneiderman, Ben; Plaisant, Catherine (May 7, 2004).Designing the user interface (4th ed.).Addison Wesley.ISBN 978-0-321-19786-3.
  21. ^Galler, Bernard A.; Galler, Enid H. (January 2001). "A Career Interview with Bernie Galler".IEEE Annals of the History of Computing.23 (1):22–33.doi:10.1109/85.910847.ISSN 1058-6180.

References

[edit]
  • An Abbreviated description of the MAD compiler language,Fernando J. Corbató,Jerome H. Saltzer, Neil Barta, and Thomas N. Hastings, M.I.T. Computation Center Memorandum CC-213, June 1963.
  • CLSYS, a program to facilitate the use of the MAD translator for large (class-size) batches, Jerome H. Saltzer, M.I.T. Computation Center Memorandum CC-204. February 1963.
  • A Computer Primer for the Mad Language,Elliott Irving Organick, 1961.
  • Internal organization of the MAD translator, Arden, B. W., Galler, B. A. and Graham, R. M., pp. 28–31, CACM Volume 4 No. 1 (Jan 1961)
  • An Introduction To Algorithmic Methods Using The MAD Language, Alan B. Marcovitz and Earl J. Schweppe, Macmillan, 1966.
  • An Introduction to Digital Computers and the MAD Language, Brice Carnahan, University of Michigan.
  • The Language of Computers, Bernard A. Galler, University of Michigan, McGraw-Hill, 1962.
  • MAD at Michigan: its function & features, Arden, B. W., Galler, B. A., and Graham, R. M., pp27–28, Datamation, Volume 7 No. 12 (Dec 1961)
  • Flow Charts of The Michigan Algorithm Decoder, by G. B. Smith, SHARE General Program Library, SHARE Distribution Number 1327 PA, 1961

External links

[edit]
Implementations
Technical
standards
Dialects
Formalisms
Community
Organizations
Professional
associations
Business
Education
Government
People
ALGOL 58
MAD
ALGOL 60
Simula
ALGOL 68
Comparison
National
Other
Retrieved from "https://en.wikipedia.org/w/index.php?title=MAD_(programming_language)&oldid=1301116190"
Categories:
Hidden categories:

[8]ページ先頭

©2009-2025 Movatter.jp