Jump to content
Main menu
Main menu
move to sidebar
hide
Navigation
Main page
Recent changes
Random page
Help about MediaWiki
Special pages
Niidae Wiki
Search
Search
Appearance
Create account
Log in
Personal tools
Create account
Log in
Pages for logged out editors
learn more
Contributions
Talk
Editing
Fortran
(section)
Page
Discussion
English
Read
Edit
View history
Tools
Tools
move to sidebar
hide
Actions
Read
Edit
View history
General
What links here
Related changes
Page information
Appearance
move to sidebar
hide
Warning:
You are not logged in. Your IP address will be publicly visible if you make any edits. If you
log in
or
create an account
, your edits will be attributed to your username, along with other benefits.
Anti-spam check. Do
not
fill this in!
==Origins== [[File:John Backus 2.jpg|thumb|upright|John Backus (1924–2007) proposed the FORTRAN project in December 1953 and received the A.M. Turing Award in 1977.]] In late 1953, [[John Backus|John W. Backus]] submitted a proposal to his superiors at [[IBM]] to develop a more practical alternative to [[assembly language]] for programming their [[IBM 704]] [[mainframe computer]].<ref name="history-fortran-i-ii-333">{{cite journal |author-link=John Backus |date=October–December 1998 |title=The History of Fortran I, II, and III |url=http://www.softwarepreservation.org/projects/FORTRAN/paper/p165-backus.pdf |url-status=live |journal=[[IEEE Annals of the History of Computing]] |volume=20 |issue=4 |pages=68–78 |doi=10.1109/85.728232 |archive-url=https://web.archive.org/web/20160303230833/http://www.softwarepreservation.org/projects/FORTRAN/paper/p165-backus.pdf |archive-date=March 3, 2016 |access-date=June 17, 2020 |author-first=John |author-last=Backus}} [https://archive.org/details/history-of-fortran][https://archive.org/details/history-of-fortran]</ref>{{rp|69}} Backus' historic FORTRAN team consisted of programmers Richard Goldberg, Sheldon F. Best, Harlan Herrick, Peter Sheridan, [[Roy Nutt]], Robert Nelson, Irving Ziller, Harold Stern, [[Lois Haibt]], and [[David Sayre]].<ref name="Backus57">{{cite conference|url=http://www.softwarepreservation.org/projects/FORTRAN/paper/BackusEtAl-FortranAutomaticCodingSystem-1957.pdf|title=The FORTRAN Automatic Coding System|conference=Western Joint Computer Conference|pages=188–198|date=February 1957|doi=10.1145/1455567.1455599|author1=J. W. Backus|author-link1=John Backus|author2=R. J. Beeber|author3=S. Best|author4=R. Goldberg|author5=L. M. Haibt|author-link5=Lois Haibt|author6=H. L. Herrick|author7=R. A. Nelson|author8=D. Sayre|author-link8=David Sayre|author9=P. B. Sheridan|author10=H. Stern|author11=L. Ziller|author12=R. A. Hughes|author13=R. Nutt|author-link13=Roy Nutt}}</ref> Its concepts included easier entry of equations into a computer, an idea developed by [[J. Halcombe Laning]] and demonstrated in the [[Laning and Zierler system]] of 1952.<ref>{{cite book |last=Mindell |first=David |title=Digital Apollo |publisher=MIT Press |location=Cambridge, MA |year=2008 |page=99 | isbn=978-0-262-13497-2 | oclc=228031739 |jstor=j.ctt5hhn02}}</ref> [[File:Fortran acs cover.jpeg|thumb|upright|''The Fortran Automatic Coding System for the [[IBM 704]]'' (October 15, 1956), the first programmer's reference manual for Fortran<ref name="Sayre_1956" />]] A draft specification for ''The IBM Mathematical Formula Translating System'' was completed by November 1954.<ref name="history-fortran-i-ii-333"/>{{rp|71}} The first manual for FORTRAN appeared in October 1956,<ref name="Sayre_1956"/><ref name="history-fortran-i-ii-333"/>{{rp|72}} with the first FORTRAN [[compiler]] delivered in April 1957.<ref name="history-fortran-i-ii-333"/>{{rp|75}} Fortran produced efficient enough code for [[assembly language]] programmers to accept a [[high-level programming language]] replacement.<ref>{{cite journal |title=The Fortran I Compiler |author-first=David |author-last=Padua |journal=Computing in Science & Engineering |date=January–February 2000 |volume=2 |issue=1 |pages=70–75 |doi=10.1109/5992.814661 |bibcode=2000CSE.....2a..70P |url=http://polaris.cs.uiuc.edu/publications/c1070.pdf |archive-url=https://web.archive.org/web/20200617113640/http://polaris.cs.uiuc.edu/publications/c1070.pdf |archive-date=June 17, 2020 |quote=The Fortran I compiler was the first major project in code optimization. It tackled problems of crucial importance whose general solution was an important research focus in compiler technology for several decades. Many classical techniques for compiler analysis and optimization can trace their origins and inspiration to the Fortran I compiler.}}</ref> John Backus said during a 1979 interview with ''Think'', the IBM employee magazine, "Much of my work has come from being lazy. I didn't like writing programs, and so, when I was working on the [[IBM 701]], writing programs for computing missile trajectories, I started work on a programming system to make it easier to write programs."<ref>{{cite news|url=https://www.nbcnews.com/id/wbna17704662|title=Fortran creator John Backus dies|publisher=[[MSNBC]]|author=Brian Bergstein|date=May 20, 2007|access-date=October 29, 2018}}</ref> The language was widely adopted by scientists for writing numerically intensive programs, which encouraged compiler writers to produce compilers that could generate faster and more efficient code. The inclusion of a [[complex data type|complex number data type]] in the language made Fortran especially suited to technical applications such as electrical engineering.<ref>{{cite web | title=FORTRAN – The First Programming Language for Numeric Calculations | website=SciHi Blog | date=October 15, 2019 | url=http://scihi.org/fortran-programming/}}</ref> By 1960, versions of FORTRAN were available for the [[IBM 709]], [[IBM 650|650]], [[IBM 1620|1620]], and [[IBM 7090|7090]] computers. Significantly, the increasing popularity of FORTRAN spurred competing computer manufacturers to provide FORTRAN compilers for their machines, so that by 1963 over 40 FORTRAN compilers existed. FORTRAN was provided for the [[IBM 1401]] computer by an innovative 63-phase compiler that ran entirely in its [[magnetic-core memory|core memory]] of only 8000 (six-bit) characters. The compiler could be run from tape, or from a 2200-card deck; it used no further tape or disk storage. It kept the program in memory and loaded [[overlay (programming)|overlays]] that gradually transformed it, in place, into executable form, as described by Haines.<ref>{{cite journal | first = L. H. | last = Haines | title = Serial compilation and the 1401 FORTRAN compiler | journal = IBM Systems Journal | volume = 4 | issue = 1 | year = 1965 | pages = 73–80 | doi = 10.1147/sj.41.0073 }}</ref> This article was reprinted, edited, in both editions of ''Anatomy of a Compiler''<ref>{{cite book | first = John A. N. | last = Lee | title = Anatomy of a Compiler | publisher = Van Nostrand Reinhold | date = 1967}}</ref> and in the IBM manual "Fortran Specifications and Operating Procedures, IBM 1401".<ref>{{cite manual|title=Fortran Specifications and Operating Procedures, IBM 1401|url=http://bitsavers.org/pdf/ibm/1401/C24-1455-2_Fortran_Specifications_and_Operating_Procedures_Apr65.pdf |archive-url=https://web.archive.org/web/20170923222402/http://www.bitsavers.org/pdf/ibm/1401/C24-1455-2_Fortran_Specifications_and_Operating_Procedures_Apr65.pdf |archive-date=September 23, 2017 |url-status=live|publisher=IBM|id=C24-1455-2}}</ref> The executable form was not entirely [[machine language]]; rather, floating-point arithmetic, sub-scripting, input/output, and function references were interpreted, preceding [[UCSD Pascal]] [[P-code machine#UCSD p-Machine|P-code]] by two decades. [[IBM 1620#GOTRAN|GOTRAN]], a simplified, interpreted version of FORTRAN I (with only 12 types of statements not 32) for "load and go" operation was available (at least for the early [[IBM 1620]] computer).<ref>{{cite web |url=http://hissa.nist.gov/mlists/ibm1620/199901/19990128-2.html |title=Subject: GOTRAN ON THE IBM 1316 DISK STORAGE PACK (Serial No. K7402) |access-date=2006-03-03 |url-status=dead |archive-url=https://web.archive.org/web/20060221192243/http://hissa.nist.gov/mlists/ibm1620/199901/19990128-2.html |archive-date=2006-02-21 }}</ref> Modern Fortran, and almost all later versions, are fully compiled, as done for other high-performance languages. The development of Fortran paralleled the [[history of compiler writing|early evolution of compiler technology]], and many advances in the theory and design of [[compiler]]s were specifically motivated by the need to generate efficient code for Fortran programs. ===FORTRAN=== The initial release of FORTRAN for the IBM 704<ref name="Sayre_1956"/> contained 32 types of [[Statement (programming)|statements]], including: * {{code|DIMENSION}} and {{code|EQUIVALENCE}} statements * Assignment statements * Three-way [[Arithmetic IF|''arithmetic'' {{code|IF}}]] statement, which passed control to one of three locations in the program depending on whether the result of the arithmetic expression was negative, zero, or positive * Control statements for checking exceptions ({{code|IF ACCUMULATOR OVERFLOW}}, {{code|IF QUOTIENT OVERFLOW}}, and {{code|IF DIVIDE CHECK}}); and control statements for manipulating [[front panel|sense switches and sense lights]] ({{code|IF (SENSE SWITCH)}}, {{code|IF (SENSE LIGHT)}}, and {{code|SENSE LIGHT}}) * [[goto|{{code|GO TO}}]], computed {{code|GO TO}}, {{code|ASSIGN}}, and assigned {{code|GO TO}} * {{code|DO}} loops * Formatted I/O: {{code|FORMAT}}, {{code|READ}}, {{code|READ INPUT TAPE}}, {{code|WRITE OUTPUT TAPE}}, {{code|PRINT}}, and {{code|PUNCH}} * Unformatted I/O: {{code|READ TAPE}}, {{code|READ DRUM}}, {{code|WRITE TAPE}}, and {{code|WRITE DRUM}} * Other I/O: {{code|END FILE}}, {{code|REWIND}}, and {{code|BACKSPACE}} * {{code|PAUSE}}, {{code|STOP}}, and {{code|CONTINUE}} * {{code|FREQUENCY}} statement (for providing [[optimization (computer science)|optimization]] hints to the compiler). The arithmetic {{code|IF}} statement was reminiscent of (but not readily implementable by) a three-way comparison instruction (CAS—Compare Accumulator with Storage) available on the 704. The statement provided the only way to compare numbers—by testing their difference, with an attendant risk of overflow. This deficiency was later overcome by "logical" facilities introduced in FORTRAN IV. The {{code|FREQUENCY}} statement was used originally (and optionally) to give branch probabilities for the three branch cases of the arithmetic {{code|IF}} statement. It could also be used to suggest how many iterations a {{code|DO}} loop might run. The first FORTRAN compiler used this weighting to perform ''at compile time'' a [[Monte Carlo method|Monte Carlo simulation]] of the generated code, the results of which were used to optimize the placement of basic blocks in memory—a very sophisticated optimization for its time. The Monte Carlo technique is documented in Backus et al.'s paper on this original implementation, ''The FORTRAN Automatic Coding System'': <blockquote>The fundamental unit of program is the [[basic block]]; a basic block is a stretch of program which has one entry point and one exit point. The purpose of section 4 is to prepare for section 5 a table of predecessors (PRED table) which enumerates the basic blocks and lists for every basic block each of the basic blocks which can be its immediate predecessor in flow, together with the absolute frequency of each such basic block link. This table is obtained by running the program once in Monte-Carlo fashion, in which the outcome of conditional transfers arising out of IF-type statements and computed GO TO's is determined by a random number generator suitably weighted according to whatever FREQUENCY statements have been provided.<ref name="Backus57" /></blockquote> The first FORTRAN compiler reported diagnostic information by halting the program when an error was found and outputting an error code on its console. That code could be looked up by the programmer in an error messages table in the operator's manual, providing them with a brief description of the problem.<ref name="Sayre_1956" />{{rp|p.19–20}}<ref>{{cite book |publisher=Programming Research Department, International Business Machines Corporation |title=The FORTRAN Automatic Coding System for the IBM 704 EDPM : Preliminary Operator's Manual |date=April 8, 1957 |pages=6–37 |url=http://www.softwarepreservation.org/projects/FORTRAN/manual/Prelim_Oper_Man-1957_04_07.pdf |archive-url=https://web.archive.org/web/20140226151253/http://www.softwarepreservation.org/projects/FORTRAN/manual/Prelim_Oper_Man-1957_04_07.pdf |archive-date=February 26, 2014 |url-status=live }}</ref> Later, an error-handling subroutine to handle user errors such as division by zero, developed by NASA,<ref>{{cite web|first=Betty Jo |last=Armstead|date=January 21, 2015|url=https://spaceodyssey.dmns.org/media/62497/myyearsatnasa-_bettyjoarmstead.pdf|title=My Years at NASA|website=Denver Museum of Nature & Science|access-date=June 15, 2019|archive-date=December 24, 2019|archive-url=https://web.archive.org/web/20191224083647/https://spaceodyssey.dmns.org/media/62497/myyearsatnasa-_bettyjoarmstead.pdf |url-status=dead}}</ref> was incorporated, informing users of which line of code contained the error. ====Fixed layout and punched cards==== {{See also|Computer programming in the punched card era}} [[File:FortranCardPROJ039.agr.jpg|thumb|FORTRAN code on a [[punched card]], showing the specialized uses of columns 1–5, 6 and 73–80]] [[File:FortranCodingForm.png|thumb|A reproduction of a FORTRAN coding form, printed on paper and intended to be used by programmers to prepare programs for punching onto cards by [[keypunch]] operators. Now obsolete.]] Before the development of disk files, text editors and terminals, programs were most often entered on a [[keypunch]] keyboard onto 80-column [[punched card]]s, one line to a card. The resulting deck of cards would be fed into a card reader to be compiled. Punched card codes included no lower-case letters or many special characters, and special versions of the IBM 026 [[keypunch]] were offered that would correctly print the re-purposed special characters used in FORTRAN. Reflecting punched card input practice, Fortran programs were originally written in a fixed-column format, with the first 72 columns read into twelve 36-bit words. A letter "C" in column 1 caused the entire card to be treated as a comment and ignored by the compiler. Otherwise, the columns of the card were divided into four fields: * 1 to 5 were the label field: a sequence of digits here was taken as a label for use in DO or control statements such as GO TO and IF, or to identify a FORMAT statement referred to in a WRITE or READ statement. Leading zeros are ignored and 0 is not a valid label number. * 6 was a continuation field: a character other than a blank or a zero here caused the card to be taken as a continuation of the statement on the prior card. The continuation cards were usually numbered 1, 2, ''etc.'' and the starting card might therefore have zero in its continuation column—which is not a continuation of its preceding card. * 7 to 72 served as the statement field. * 73 to 80 were ignored (the IBM 704's [[IBM 711|card reader]] only used 72 columns).<ref>{{cite manual |url=http://www.bitsavers.org/pdf/ibm/7090/22-6528-4_7090Manual.pdf |archive-url=https://web.archive.org/web/20081201175757/http://bitsavers.org/pdf/ibm/7090/22-6528-4_7090Manual.pdf |archive-date=December 1, 2008 |url-status=live |title=Reference Manual, IBM 7090 Data Processing System |date=1961 |id=A22-6528-3}}</ref> Columns 73 to 80 could therefore be used for identification information, such as punching a sequence number or text, which could be used to re-order cards if a stack of cards was dropped; though in practice this was reserved for stable, production programs. An [[IBM 519]] could be used to copy a program deck and add sequence numbers. Some early compilers, e.g., the IBM 650's, had additional restrictions due to limitations on their card readers.<ref>{{cite manual |url= http://www.bitsavers.org/pdf/ibm/fortran/F28-8074-3_FORTRANII_GenInf.pdf |archive-url=https://web.archive.org/web/20050426055632/http://www.bitsavers.org/pdf/ibm/fortran/F28-8074-3_FORTRANII_GenInf.pdf |archive-date=April 26, 2005 |url-status=live |title=Fortran II General Information Manual |date=1963 |access-date=November 19, 2014 }}</ref> [[Keypunch]]es could be programmed to tab to column 7 and skip out after column 72. Later compilers relaxed most fixed-format restrictions, and the requirement was eliminated in the Fortran 90 standard. Within the statement field, [[whitespace character]]s (blanks) were ignored outside a text literal. This allowed omitting spaces between tokens for brevity or including spaces within identifiers for clarity. For example, {{code|AVG OF X}} was a valid identifier, equivalent to {{code|AVGOFX}}, and <syntaxhighlight lang="fortran" inline>101010DO101I=1,101</syntaxhighlight> was a valid statement, equivalent to <syntaxhighlight lang="fortranfixed" inline>10101 DO 101 I = 1, 101</syntaxhighlight> because the zero in column 6 is treated as if it were a space (!), while <syntaxhighlight lang="fortran" inline>101010DO101I=1.101</syntaxhighlight> was instead <syntaxhighlight lang="fortranfixed" inline>10101 DO101I = 1.101</syntaxhighlight>, the assignment of 1.101 to a variable called <syntaxhighlight lang="fortran" inline>DO101I</syntaxhighlight>. Note the slight visual difference between a comma and a period. [[Hollerith constant|Hollerith strings]], originally allowed only in FORMAT and DATA statements, were prefixed by a character count and the letter H (e.g., {{code|26HTHIS IS ALPHANUMERIC DATA.}}), allowing blanks to be retained within the character string. Miscounts were a problem.
Summary:
Please note that all contributions to Niidae Wiki may be edited, altered, or removed by other contributors. If you do not want your writing to be edited mercilessly, then do not submit it here.
You are also promising us that you wrote this yourself, or copied it from a public domain or similar free resource (see
Encyclopedia:Copyrights
for details).
Do not submit copyrighted work without permission!
Cancel
Editing help
(opens in new window)
Search
Search
Editing
Fortran
(section)
Add topic