Thanks Doug!
So Unix m6 was a port of the Fortran version, it sounds like.
Q1. When and why was it dropped from Unix? When and why did m4
enter the picture?
Q2. What's the history of Fortran on Unix? Clearly there was a
lot of Fortran going on in 1127 (cf. BWK's book, ratfor,
software tools ...) Who wrote the first Unix fortran compiler?
Much thanks,
Arnold
Doug McIlroy <doug(a)cs.dartmouth.edu> wrote:
M6 originated as a porting tool for the Fortran source code
for Stan Brown's Altran language for algebraic computation. M6
itself was originally written in highly portable Fortran.
Arnold asked, "How widespread was the use of macro processors
in high level languages? They were big for assembler, and
PL/1 had a macro language, but I don't know of any other
contemporary languages that had them."
Understanding "contemporary" to mean pre-C, I agree. Cpp,
a particularly trivial macroprocessor, has been heavily used
ever since--even for other languages, e.g. Haskell.
The rumor that Bob Morris invented macros is off the
mark. Macros were in regular use by the time he joined Bell
Labs. He did conceive an interesting "form-letter generator",
called "form", and an accompanying editor "fed". A sort of
cross between macros and Vannevar Bush's hypothetical memex
repository, these were among the earliest Unix programs and
appeared in the manual from v1 through v6.
Off-topic warning: pre-Unix stories follow.
Contrary to an assertion on
cat-v.org, I did not invent macros
either. In 1959 Doug Eastwood and I, at the suggestion of
George Mealy, created the macro facility for SAP (SHARE assmbly
program) for the IBM 704. However, the idea was in the air at
the time. In particular, we knew that GE already had macros,
though we knew no details about their syntax or semantics.
There were various attempts in the 1960s to build languages by
macro extension. The approach turned out to entail considerable
social cost: communication barriers arise when everyone
can easily create his own dialect. A case in point: I once
had a bright young mathematician summer employee who wrote
wonderfully concise code by heaping up macro definitions. The
result was inscrutable.
Macros caught on in a big way in the ESS labs at Indian Hill.
With a macro-defined switching language, code builds were
slow. One manager there boasted that his lab made more
thoroughgoing use of computers than other departments and
cited enormous consumption of machine time as evidence.
Steve Johnson recalls corrrectly that there was a set of macros
that turned the assembler into a Lisp compiler. I wrote it
and used it for a theorem-proving project spurred by Martin
Davis. (The project was blown away when Robinson published
the resolution princple.) The compiler did some cute local
optimization, taking account of facts such as Bob Morris's
astute observation that the 704 instruction TNZ (transfer on
nonzero) sets the accumulator to zero.
Doug