there's a book just over your shoulder
that's carefully been placed there
can you pick the book and tell me about
it
right great book you should buy the
newer version of this
sorry
brief commercial announcement um
yeah sure um i think i mentioned at some
point in our conversation the fact that
the people working on multics well
maltex was sort of the second version of
time sharing that was done at mit with
collaboration of bell labs and general
electric very big system for providing
in effect a computing utility for
programmers multix was actually being
written in high-level languages they
started with pl1 which was not a good
choice
and then they moved to bcpl
a language which was developed in fact
by martin richards cambridge
the people doing that who are at bell
labs in particular ken thompson and
dennis ritchie had gotten used to the
idea that you could write really
interesting operating system kinds of
software and tools that supported it in
high-level languages you weren't writing
assembly language
and
so when they started working on unix
this very small stripped-down version
that was done at bell labs
they were at the same time exploring the
use of high-level languages and
there were a variety of these there was
a language called b
which was the first attempt it was done
by ken thompson a very simple language
and
i suppose you could say it was sort of
like a stripped down version of bcpl
it's you know kind of a weak naming
convention there um and so
you could do interesting things with b
but it wasn't quite powerful enough
and in particular it was an interpreter
not a compiler
and that meant it didn't generate
machine code for the particular machine
it was running on it was just a program
that interpreted what it was trying to
say so it meant it ran relatively slowly
the other thing is that the language did
not support
the architecture of newer machines that
were showing up in particular the pdp
11.
newer machines instead of having
everything in the machine be a single
size of in effect integer let's say 16
bits or something like that they had
different sizes that were the machine
would efficiently and naturally
manipulate 8 bits 16 bit maybe 32 bits
and the language b didn't reflect that
and so dennis ritchie undertook to
design what amounted to a version of b
that was richer and had mechanisms in
the language to say this is an 8-bit
quantity this is a 16-bit quantity
basically the care and int types that
you see in the early versions of c
and so he wrote a compiler for that and
then with the compiler in hand they
started to rewrite the operating system
itself in c and this took a while
something in the order of six months to
get that working and at that point then
you've got the
operating system and of course all kinds
of other critical core software written
in a high-level language rather than in
assembly language and that's important
for all kinds of reasons one it means
that
it's just a lot easier for lots of
people to see what the code does you
don't need so much expertise because
it's in the high level language and the
other thing is that
it's portable in the sense that if
somebody makes a c compiler for a
different kind of machine different
architecture
then you can recompile whatever your
program is for that new architecture and
then that way you can move your program
to a different machine now this has
always been the advantage of high-level
languages but now you could do it for
the operating system and that meant that
unix the operating system no longer was
only pdp 11 but could run on a variety
of other machines as well i think the
concept of having a high level language
i get right you can compile it down to
hex's machine code that right tells the
processors to do stuff right and if you
have a different compiler for a
different machine it just changes what
those hex codes are correct that's
exactly right so so
it should be really simple to understand
how to write an os in a high-level
language but is it a bit like
making a sharper tool and using that
sharper tool to make a sharper tool yeah
right i think in fact and and the
complication is
in building and writing an operating
system in a high-level language and
translating it into let's say multiple
different
architectures
is
there's a lot of detail to get right
there and there are some things which
the high-level language just doesn't
support so you need a little tiny bit of
assembly language assist for any given
operating system the one that's more
like the conceptual problem that you
were explaining well is how does the
compiler itself get started because of
course the c compiler is written in c
and so there's the how do you get it
started and your idea of
the sharper tool making yet a sharper
tool and so on is metaphorically the
right idea because what you do is you
say i wrote some code in c
on paper
let me mechanically translate that
into something that will process a bit
more of c code and then
bootstrap myself up from that so it's a
bootstrapping process and i've never
done it so i
take me
with a grain of salt on that but that's
the basic idea
okay so and then tell me about this but
how did this come about
so i'm looking i think that's relatively
early uh edition that's the first
edition yes yes
uh this one isn't actually oh dear oh
dear this however is the 24th printing
so
who just points out a professor
for the autograph
okay i will autograph it um
how did the book come about um
somewhere early on in this process of
people building interesting languages i
got intrigued by the idea of how do you
explain those languages to other people
and so i wrote tutorial documents i
wrote a tutorial document on b so that
people could learn b because ken
thompson and to a lesser degree dennis
didn't write tremendous amount of
documentation let's say it was spare and
there was not much tutorial stuff so i
wrote a tutorial document on b that was
useful when c came along then i wrote a
tutorial document on c
and at some point
i had already written i guess a couple
of books at that point and it seemed
like the market
the market that there might be a market
for a c book um and so i twisted dennis
ritchie's arm into writing the book with
me and that is the smartest thing i ever
did in my whole life no ambiguity
so we uh took my tutorial document as
kind of a piece of it we took his
reference manual which is a really
excellent reference manual as a big
piece of it took that verbatim and then
we filled in material in the middle to
explain the various parts of the
language at more length um and we
published that we wrote it in 1977
published at the beginning of 78 and of
course it was done with all of the
document preparation tools that we had
been working on over the years and so it
had mathematical expressions in it using
eqn it had tables of things like
operators using mike lesk's tbl program
it the first edition predates pic the
picture
a drawing language but the second
edition has picked pictures and so on so
is this incestuous or is this building
on what other people have done i don't
know but but that's how it came about um
and i remember talking to the editor
this was published by prentice hall um
with carl carlstrom uh
the editor there
and i remember a discussion with him
about
how many copies do you think this will
sell and i no idea well maybe five
thousand so so it's done better than
that
just just as well
it was never an a because it was b was
based on there was
there was a language steve johnson who
was all part of this the creator of yak
steve johnson's been a sabbatical at the
university of waterloo in ontario and he
came back with a link
i don't somebody else had done it a
language there called a but it was
spelled eh
a bit of canadian humor i guess