[TUHS] Recreation of the PDP-7 UNIX TMG compiler compiler
scj at yaccman.com
scj at yaccman.com
Fri Nov 19 05:01:05 AEST 2021
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
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.
> On Thu, Oct 14, 2021 at 11:56 AM Lars Brinkhoff <lars at nocrew.org>
>> 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!
More information about the TUHS