Computer Old Farts Forum
 help / color / mirror / Atom feed
* [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; 10+ 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] 10+ messages in thread
* [COFF] Re: machine code translation,as mental architecture models
  2024-07-13 22:00 ` Douglas McIlroy
@ 2024-07-13 23:46 John Levine
  2024-07-13 22:00 ` Douglas McIlroy
  0 siblings, 1 reply; 10+ messages in thread
From: John Levine @ 2024-07-13 23:46 UTC (permalink / raw)
  To: coff; +Cc: douglas.mcilroy

It appears that Douglas McIlroy <douglas.mcilroy@dartmouth.edu> said:
>-=-=-=-=-=-
>
>> 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 looked at the manual and I think he's misreading it. The "words" in
question are the tokens in the macro definition. 

The example macros look pretty straightforward, instructions and
pseudo-ops that are expanded replacing dummy arguments by actual ones.
There's no conditional assembly so each macro is just a parameterized
chunk of code.

https://bitsavers.org/pdf/dec/pdp1/PDP-1_Macro.pdf

R's,
John

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

end of thread, other threads:[~2024-07-17 17:00 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-07-15 12:37 [COFF] Re: ancient macros, machine code translation,as mental architecture models 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
2024-07-17 17:00       ` [COFF] Re: ancient macros Aron Insinga
  -- strict thread matches above, loose matches on Subject: below --
2024-07-13 23:46 [COFF] Re: machine code translation,as mental architecture models John Levine
2024-07-13 22:00 ` Douglas McIlroy
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

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