* [TUHS] Recreation of the PDP-7 UNIX TMG compiler compiler
@ 2021-10-13 20:53 Phil Budne
2021-10-14 15:38 ` Lars Brinkhoff
2021-10-14 22:42 ` Robert Swierczek
0 siblings, 2 replies; 8+ messages in thread
From: Phil Budne @ 2021-10-13 20:53 UTC (permalink / raw)
To: tuhs
I was a member of the team that typed in scans of PDP-7 UNIX (the
first batch of scans done didn't include the shell, so I cobbled one
together in March of 2016).
Scans of a second batch of listings turned up and were entered two
years ago (October 2019), including the original shell, and appeared
to be part of Doug McIlroy's implementation of TMG (TransMoGrifier),
the compiler compiler first used to implement B.
In January 2020 we got confirmation that the files t1.s thru t8.s
were, in fact, for TMG, but that we were missing the compiler for the
TMGL language, written in TMGL and the generated code.
In what is perhaps best described as a crazed act, over the past two
months I've worked to recreate a working TMG environment on PDP-7
UNIX, including a B compiler in TMGL, currently available at:
https://github.com/philbudne/pdp7-unix/tree/tmg
A good starting place is
https://github.com/philbudne/pdp7-unix/blob/tmg/misc/tmg-notes.txt
which started as my collected notes, questions and findings, and I've
expanded it with prose, observations and thoughts that could, at least
conceivably, be of interest to those not as oriented towards
self-punishment as I am.
(and on that topic, if you're looking for someone to expand, contract,
or otherwise deal with some seemingly intractable legacy code, let me
know: http://www.regressive.org/phil/resume.html)
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [TUHS] Recreation of the PDP-7 UNIX TMG compiler compiler
2021-10-13 20:53 [TUHS] Recreation of the PDP-7 UNIX TMG compiler compiler Phil Budne
@ 2021-10-14 15:38 ` Lars Brinkhoff
2021-10-14 16:53 ` Douglas McIlroy
2021-10-14 22:42 ` Robert Swierczek
1 sibling, 1 reply; 8+ messages in thread
From: Lars Brinkhoff @ 2021-10-14 15:38 UTC (permalink / raw)
To: Phil Budne; +Cc: tuhs
Phil Budne wrote:
> In what is perhaps best described as a crazed act, over the past two
> months I've worked to recreate a working TMG environment on PDP-7
> UNIX, including a B compiler in TMGL, currently available at:
Very impressive!
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [TUHS] Recreation of the PDP-7 UNIX TMG compiler compiler
2021-10-14 15:38 ` Lars Brinkhoff
@ 2021-10-14 16:53 ` Douglas McIlroy
2021-10-14 17:06 ` Will Senn
2021-11-18 19:01 ` scj
0 siblings, 2 replies; 8+ messages in thread
From: Douglas McIlroy @ 2021-10-14 16:53 UTC (permalink / raw)
To: Phil Budne, TUHS main list, Lars Brinkhoff
Impressive indeed. And I imagine the feat will impress its brilliant
grandparent, Bob McClure (cc'd), too.
Even though I wrote that TMG way back when, I'd never have dared to
try resuscitating it. Thank you, Phil.
Doug
On Thu, Oct 14, 2021 at 11:56 AM Lars Brinkhoff <lars@nocrew.org> wrote:
>
> Phil Budne wrote:
> > In what is perhaps best described as a crazed act, over the past two
> > months I've worked to recreate a working TMG environment on PDP-7
> > UNIX, including a B compiler in TMGL, currently available at:
>
> Very impressive!
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [TUHS] Recreation of the PDP-7 UNIX TMG compiler compiler
2021-10-14 16:53 ` Douglas McIlroy
@ 2021-10-14 17:06 ` Will Senn
2021-11-18 19:01 ` scj
1 sibling, 0 replies; 8+ messages in thread
From: Will Senn @ 2021-10-14 17:06 UTC (permalink / raw)
To: Douglas McIlroy; +Cc: TUHS main list
Original goes back to 1965, the year I was born. Crazy what they were capable of back then. Way to go Phil.
Sent from my iPhone
> On Oct 14, 2021, at 11:53 AM, Douglas McIlroy <douglas.mcilroy@dartmouth.edu> wrote:
>
> Impressive indeed. And I imagine the feat will impress its brilliant
> grandparent, Bob McClure (cc'd), too.
>
> Even though I wrote that TMG way back when, I'd never have dared to
> try resuscitating it. Thank you, Phil.
>
> Doug
>
>> On Thu, Oct 14, 2021 at 11:56 AM Lars Brinkhoff <lars@nocrew.org> wrote:
>>
>> Phil Budne wrote:
>>> In what is perhaps best described as a crazed act, over the past two
>>> months I've worked to recreate a working TMG environment on PDP-7
>>> UNIX, including a B compiler in TMGL, currently available at:
>>
>> Very impressive!
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [TUHS] Recreation of the PDP-7 UNIX TMG compiler compiler
2021-10-13 20:53 [TUHS] Recreation of the PDP-7 UNIX TMG compiler compiler Phil Budne
2021-10-14 15:38 ` Lars Brinkhoff
@ 2021-10-14 22:42 ` Robert Swierczek
2021-10-15 1:21 ` Ken Thompson
1 sibling, 1 reply; 8+ messages in thread
From: Robert Swierczek @ 2021-10-14 22:42 UTC (permalink / raw)
To: Phil Budne; +Cc: TUHS main list
> In what is perhaps best described as a crazed act, over the past two
> months I've worked to recreate a working TMG environment on PDP-7
> UNIX, including a B compiler in TMGL
Awesome! That is quite the feat!
Rob
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [TUHS] Recreation of the PDP-7 UNIX TMG compiler compiler
2021-10-14 22:42 ` Robert Swierczek
@ 2021-10-15 1:21 ` Ken Thompson
0 siblings, 0 replies; 8+ messages in thread
From: Ken Thompson @ 2021-10-15 1:21 UTC (permalink / raw)
To: Robert Swierczek; +Cc: TUHS main list
[-- Attachment #1: Type: text/plain, Size: 320 bytes --]
wow!
On Thu, Oct 14, 2021 at 3:43 PM Robert Swierczek <rmswierczek@gmail.com>
wrote:
> > In what is perhaps best described as a crazed act, over the past two
> > months I've worked to recreate a working TMG environment on PDP-7
> > UNIX, including a B compiler in TMGL
>
> Awesome! That is quite the feat!
>
> Rob
>
[-- Attachment #2: Type: text/html, Size: 650 bytes --]
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [TUHS] Recreation of the PDP-7 UNIX TMG compiler compiler
2021-10-14 16:53 ` Douglas McIlroy
2021-10-14 17:06 ` Will Senn
@ 2021-11-18 19:01 ` scj
1 sibling, 0 replies; 8+ messages in thread
From: scj @ 2021-11-18 19:01 UTC (permalink / raw)
To: Douglas McIlroy; +Cc: TUHS main list
I was deeply motivated by TMG. The good news is that you could say what
you wanted and it just did it. The bad news was the error handling.
Because it was recursive if you made a syntax error the program
backtracked and tried again. And again. And again. And eventually was
back at the first character of the input with nowhere to go. So it
issued one of its two messages -- "Syntax Error". No hint as to where
it was. The other message was something like "Internal Error: call
X1234". It very much encouraged a "write one line and compile"
approach. It was my moaning about this in Aho's presence that got us
started on LR parsing and led to Yacc.
There was actually a similar problem with Yacc. I made an attempt to
recover from syntax errors so I could give more than one useful message
from Yacc. But there was a lot of cross-checking in the various
modules, and the result was usually an internal error that I detected
and reported. I naively assumed that if there was a syntax error the
user would fix that and rerun. But instead, there was a steady stream
of people coming in to tell me about these fatal internal errors in
Yacc.
When I realized that 95% of those internal errors were triggered by
syntax errors, I set a flag when there was a syntax error and if the
flag was on I changed the internal error message to "Cannot recover from
earlier errors." About a week later, I gave a talk on Yacc and several
people mentioned that Yacc used to "crash" all the time, but in the last
week it had become much more stable...
---
On 2021-10-14 09:53, Douglas McIlroy wrote:
> Impressive indeed. And I imagine the feat will impress its brilliant
> grandparent, Bob McClure (cc'd), too.
>
> Even though I wrote that TMG way back when, I'd never have dared to
> try resuscitating it. Thank you, Phil.
>
> Doug
>
> On Thu, Oct 14, 2021 at 11:56 AM Lars Brinkhoff <lars@nocrew.org>
> wrote:
>>
>> Phil Budne wrote:
>> > In what is perhaps best described as a crazed act, over the past two
>> > months I've worked to recreate a working TMG environment on PDP-7
>> > UNIX, including a B compiler in TMGL, currently available at:
>>
>> Very impressive!
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [TUHS] Recreation of the PDP-7 UNIX TMG compiler compiler
@ 2021-11-20 15:02 Douglas McIlroy
0 siblings, 0 replies; 8+ messages in thread
From: Douglas McIlroy @ 2021-11-20 15:02 UTC (permalink / raw)
To: TUHS main list
> I was deeply motivated by TMG. The good news is that you could say what
> you wanted and it just did it. The bad news was the error handling.
> Because it was recursive if you made a syntax error the program
> backtracked and tried again. And again. And again. And eventually was
> back at the first character of the input with nowhere to go. So it
> issued one of its two messages -- "Syntax Error".
This is somewhat of a caricature. If one's compilation strategy were
to build an abstract syntax tree of the whole source program before
emitting any object code, then things would go as Steve describes.
In reality, TMG wasn't used this way. For one thing, ASTs needed
too much memory.
In TMG one could emit code while parsing. Typically code
was generated on a statement-by-statement basis. This limited
the backtracking, so even a naive "syntax error" diagnostic could
be localized to the statement level. Long-distance connections, such
as the branch labels in a nest of if statements, could nevertheless
be realized recursively.
Thus, in actual use, a TMG "grammar" was partly a parsing program
and partly abstract specification. The balance of viewpoints was
left to the discretion of the grammar's author. Yacc swung the
pendulum toward the abstract.
Doug
^ permalink raw reply [flat|nested] 8+ messages in thread
end of thread, other threads:[~2021-11-20 15:05 UTC | newest]
Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-10-13 20:53 [TUHS] Recreation of the PDP-7 UNIX TMG compiler compiler Phil Budne
2021-10-14 15:38 ` Lars Brinkhoff
2021-10-14 16:53 ` Douglas McIlroy
2021-10-14 17:06 ` Will Senn
2021-11-18 19:01 ` scj
2021-10-14 22:42 ` Robert Swierczek
2021-10-15 1:21 ` Ken Thompson
2021-11-20 15:02 Douglas McIlroy
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).