First C compiler source code from 1972
15 comments
·March 27, 2025cpr
Wow, that brings back memories!
First saw the C compiler sources on Geoff Steckel (local guru)'s desk around 1973 at the Harvard graduate computing center, and was absolutely floored at this fascinating-looking language. (Harvard got the first Unix tapes outside of Bell Labs; not sure of the connection there.)
All upper-case, of course, as the DEC lineprinters didn't have lower case yet. Real upper case was struck-through upper.
zahlman
> These are not capable of being compiled today with modern c compilers like gcc
Is that only because it includes PDP-11 assembly code, or has the language changed too much?
sanxiyn
As documented in http://cs.bell-labs.co/who/dmr/chist.html, the primary incompatibility is uses of =+ for +=. Grep for =+ in the repository.
makeset
That's sed-able, if it were just that.
vaxman
PDP-7 Macro Assembler
BTW, Unix on DEC hardware was never really popular outside of academia so DEC's machines were primarily programmed in FORTRAN, BASIC or Macro assembler, but there were still several third-party C compilers (for RT11, RSX11, RSTS/E, TOPS and VMS). My shop had spun off of Bell Labs so we had just a few Unix weirdos running things, but the bazillion dollar VAXcluster only ran VMS, so they made us all use Whitesmith's C (which they would incorrectly pronounce with three syllables) which was horrible - so was constantly getting in trouble for continuing to work the evil FORTRAN77 ways 'til one day a Lead (pear-shaped Unix grandmaster smellable from 20 feet away) dropped this on my desk with a thud http://www.bitsavers.org/pdf/dec/vax/lang/c/AA-L370A-TE_Prog... Soon, I was spending my hard earned dollars on Lattice and Aztec C licenses for my own home-brew systems too. I resisted Unix to the very End tho #rofl
qq66
How was the first C compiler written in C?
mystified5016
It wasn't. You typically bootstrap a compiler by first writing a compiler in an existing language. Then you get a compiler that can sort of compile your langauge, but the bootstrapping language contaminates your assembly. So you iteratively compile the compiler with itself until it's purely in the new language.
The very first compilers were bootstrapped from handwritten assembly. C was famously bootstrapped from B. GCC started in assembly I think and has been compiling itself for decades.
null
webprofusion
It's cool but it's not getting any more newsworthy. Submitted 9 times to HN so far since 2013.
rajamaka
I browse HN daily and have never seen it
johnisgood
https://news.ycombinator.com/item?id=43433030 (submitted 3 days ago, ~370 points).
It is fine to not see it, however, that is why I am giving you the link, although someone else already posted it 6 hours ago (from now).
n4r9
It's good to revisit old topics from time to time.
Dupe of: https://news.ycombinator.com/item?id=43433030