JOVANA
Library Glossary Getting Started Three Levels Fields How it works Mission
Join the mission
Back to the library
Programming Languages 1957

The FORTRAN Automatic Coding System

John W. Backus et al. (IBM)

Write the mathematics, not the machine's addresses — and let a program compile it into code as fast as a human's.

Choose your version
In depth · the introduction

Before 1957, telling a computer what to do meant writing in its raw numeric language, address by address, by hand. FORTRAN let you write the maths instead — and had the machine do the rest.

The big idea

A computer only understands long lists of tiny numbered orders — load this number, add that one, store the result here. Writing those lists by hand was slow, mind-numbing, and error-prone. FORTRAN introduced two things together: a high-level language, in which you write something close to ordinary algebra, and a compiler, a program that reads your formula and writes out all the machine's tiny orders for you.

So instead of dozens of cryptic instructions, you could write one line — Y = A*X**2 + B*X + C — and the compiler would translate it, automatically, into fast machine code. The radical part was that nobody believed a machine could do this translation well enough. FORTRAN's compiler proved it could: the code it produced ran almost as fast as code a human expert wrote by hand.

How it came about

The project began at IBM in 1954, led by a young researcher named John Backus, for IBM's powerful new 704 computer. At the time, simply preparing a problem for a computer — writing and debugging the program — cost more than the computing itself. Backus's pitch was to slash that cost with automatic coding.

He met deep scepticism. Expert programmers took pride in hand-crafting tight machine code and doubted any automatic system could match them. So Backus's team made efficiency their obsession: the compiler would not just translate, it would optimise, working hard to use the machine's scarce fast registers wisely. It took about three years and an enormous programming effort. When the compiler was delivered in 1957, it worked — and the doubters were won over.

Why it mattered

FORTRAN opened programming to the people who actually had problems to solve — scientists and engineers — instead of confining it to a priesthood of machine-code specialists. It made software dramatically cheaper and faster to write, and in doing so helped create the software industry itself. The very words we use — compiler, high-level language — entered ordinary use through it.

A way to picture it

Think of sheet music. A composer writes a melody in clean, readable notation — a few lines on a page. A skilled performer then turns each note into the exact, rapid finger movements that actually make the sound. FORTRAN is the performer: you write the readable notation, and the compiler renders it, note for note, into the thousands of precise little movements the machine must make — and renders it nearly as well as the finest hand could.

Type an arithmetic formula and the widget compiles it into a numbered list of the small machine steps a computer must run, in the right order, showing how one readable line expands into many.

Where it sits

FORTRAN was not the very first attempt at automatic programming — Grace Hopper had built early compilers, and others had tried algebraic systems — but it was the first to be both efficient and widely adopted, which is what made it stick. After it came a flood of languages: ALGOL, COBOL, BASIC, C, and eventually Python. The reaction against its tangled GO TO style led Edsger Dijkstra and others to structured programming, a thread you can follow elsewhere in this Library.

The original document
Original source text
J. W. Backus, R. J. Beeber, S. Best, R. Goldberg, L. M. Haibt, H. L. Herrick, R. A. Nelson, D. Sayre, P. B. Sheridan, H. Stern, I. Ziller, R. A. Hughes, R. Nutt · Proc. Western Joint Computer Conference (1957): 188–198
Why it was built
By the mid-1950s, writing and debugging a program by hand — in the IBM 704's raw numeric code, juggling memory addresses and index registers — had become the dominant cost of using a computer. The FORTRAN team's aim was to let a programmer state a numerical procedure in a concise notation close to mathematics, and have the machine produce automatically an efficient 704 program to carry it out.
The language
FORTRAN gave the programmer arithmetic assignment statements written like algebra (with the precedence ** before × and ÷, before + and −), variable and array names of up to six characters declared by DIMENSION, formatted input/output, the GO TO branch, the counting DO loop, and the three-way arithmetic IF. Two of its most characteristic lines:
DO 5 I = 1, 10
The DO statement repeats every statement down to the one labelled 5, for I running 1, 2, … 10 — the ancestor of the counting loop in every language since. The other:
IF (X) 10, 20, 30
The arithmetic IF jumps to statement 10 if X is negative, to 20 if it is zero, and to 30 if it is positive — branching directly on the sign of an expression.
The translator
The compiler ran in six sections. Its celebrated, hardest work was optimization: it analysed the flow through nested DO loops, treated array subscripts as functions of the loop indices, and allocated the 704's three index registers across each region of the program using a frequency analysis of how often each path would run — keeping the busiest indices in registers. This was register allocation and loop optimization, decades before those names existed.
What it set out to do
The project's overriding aim was that the object program should be nearly as efficient as one a good programmer would write by hand — otherwise no one would trust a high-level language — while cutting the labour of coding and debugging to a fraction of what it had been. Meeting both goals at once was the achievement.
[ … ]
IBM · 1957