Computer Old Farts Forum
 help / color / mirror / Atom feed
* [COFF] Re: machine code translation,as mental architecture models
@ 2024-07-13 22:00 Douglas McIlroy
  2024-07-13 23:46 ` John Levine
  0 siblings, 1 reply; 14+ messages in thread
From: Douglas McIlroy @ 2024-07-13 22:00 UTC (permalink / raw)
  To: COFF

[-- Attachment #1: Type: text/plain, Size: 342 bytes --]

> the DEC PDP-1 MACRO assembler manual says that a macro call
> is expanded by copying the *sequence of 'storage words' and
> advancing the current location (.) for each word copied*

> I am quite surprised.

I am, too. It seems that expansion is not recursive. And that it can only
allocate storage word by word, not in larger blocks.

Doug

[-- Attachment #2: Type: text/html, Size: 586 bytes --]

^ permalink raw reply	[flat|nested] 14+ messages in thread
* [COFF] Re: ancient macros, machine code translation,as mental architecture models
@ 2024-07-15 12:37 Douglas McIlroy
  2024-07-15 14:26 ` Paul Winalski
  2024-07-15 19:39 ` John Levine
  0 siblings, 2 replies; 14+ messages in thread
From: Douglas McIlroy @ 2024-07-15 12:37 UTC (permalink / raw)
  To: COFF

[-- Attachment #1: Type: text/plain, Size: 1534 bytes --]

In 1959, when Doug Eastwood and I,  at the suggestion  of George Mealy, set
out to add macro capability to SAP (Share assembly program), the word
"macro"--short for "macroinstruction"--was in the air, though none of us
had ever seen a macroprocessor. We were particularly aware that GE had a
macro-capable assembler. I still don't know where or when the term was
coined. Does anybody know?

We never considered anything but recursive expansion, where macro
definitions can contain macro calls; thus the TX-0 model comes as quite a
surprise. We kept a modest stack of the state of each active macro
expansion. We certainly did not foresee that within a few years some
applications would need a 70-level stack!

General stack-based programming was not common practice (and the term
"stack" did not yet exist). This caused disaster the first time we wrote a
macro that generated a macro definition, because a data-packing subroutine
with remembered state, which was used during both definition and expansion,
was not reentrant. To overcome the bug we had in effect to introduce
another small  stack to keep the two uses out of each other's way. Luckily
there were no more collisions between expansion and definition. Moreover,
this stack needed to hold only one suspended state because expansion could
trigger definition but not vice versa.

Interestingly, the problem in the previous paragraph is still with us 65
years later in many programming languages. To handle it gracefully, one
needs coroutines or higher-order functions.

Doug

[-- Attachment #2: Type: text/html, Size: 1729 bytes --]

^ permalink raw reply	[flat|nested] 14+ messages in thread

end of thread, other threads:[~2024-07-16 20:09 UTC | newest]

Thread overview: 14+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-07-13 22:00 [COFF] Re: machine code translation,as mental architecture models Douglas McIlroy
2024-07-13 23:46 ` John Levine
2024-07-14  0:54   ` Dan Cross
2024-07-14  1:04     ` Aron Insinga
2024-07-14  0:56   ` Aron Insinga
2024-07-14 18:02     ` [COFF] Re: ancient macros, " John Levine
2024-07-15  1:44       ` Aron Insinga
2024-07-15 14:09         ` Paul Winalski
2024-07-15 12:37 Douglas McIlroy
2024-07-15 14:26 ` Paul Winalski
2024-07-15 14:38   ` Bakul Shah via COFF
2024-07-15 19:39 ` John Levine
2024-07-16 19:55   ` Aron Insinga
2024-07-16 20:09     ` Aron Insinga

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).