Dennis Ritchie's first C compiler on Github
1–10 of 88 posts
Re: Dennis Ritchie's first C compiler on Github
#2Re: Dennis Ritchie's first C compiler on Github
#3Is this written in C? If so, what compiled this? Sorry for the noob question, I'm just a little lost.
Re: Dennis Ritchie's first C compiler on Github
#4Is this written in C? If so, what compiled this? Sorry for the noob question, I'm just a little lost.
init(s, t)
char s[]; {
would be equivalent to: int init(char s[], int t) {
This still works with modern compilers.I'd be interested if anyone has any more info about this:
waste() /* waste space */
{
waste(waste(waste),waste(waste),waste(waste));
waste(waste(waste),waste(waste),waste(waste));
waste(waste(waste),waste(waste),waste(waste));
waste(waste(waste),waste(waste),waste(waste));
waste(waste(waste),waste(waste),waste(waste));
waste(waste(waste),waste(waste),waste(waste));
waste(waste(waste),waste(waste),waste(waste));
waste(waste(waste),waste(waste),waste(waste));
}
Found in last1120c/c10.cRe: Dennis Ritchie's first C compiler on Github
#5Re: Dennis Ritchie's first C compiler on Github
#6Is this written in C? If so, what compiled this? Sorry for the noob question, I'm just a little lost.
http://cm.bell-labs.com/cm/cs/who/dmr/primevalC.html
Which led me to here:
http://cm.bell-labs.com/cm/cs/who/dmr/chist.html
Where, if you take the time, you will find a wonderful story, upon completing, you will probably know more about the early embryonic history of C then 95% of your peers.
(Spoiler - We start with BCPL, then Move to B - it's left as an exercise to determine how we originally compiled BCPL)
Re: Dennis Ritchie's first C compiler on Github
#7Turns out, this Github-repo is just a mirror/copy of his work, but with attribution [2]. Still worth reading through there, tuhs also stores some extremely old UNIX versions.
[1] www.tuhs.org
[2] http://cm.bell-labs.com/cm/cs/who/dmr/primevalC.html
Edit: Warren has written a paper on restoring ancient UNIX versions and C-compilers, you might like it [3]
[3] http://epublications.bond.edu.au/infotech_pubs/146/
Edit2: Now that I've thought a little bit about it, I'm not happy that the sources are on GitHub in this form. This is Warren's work - he did a lot of work in getting these tapes to work again, and "mortdeus" just copied the work and didn't even change the folder-names - "last1120c" is the first tape, "prestruct" the second. And you still need Warren's Apout emulator to get these files to work.
Re: Dennis Ritchie's first C compiler on Github
#8Is this written in C? If so, what compiled this? Sorry for the noob question, I'm just a little lost.
Re: Dennis Ritchie's first C compiler on Github
#9Is this written in C? If so, what compiled this? Sorry for the noob question, I'm just a little lost.
It compiles itself! http://en.wikipedia.org/wiki/Bootstrapping_(compilers)
Re: Dennis Ritchie's first C compiler on Github
#10Is this written in C? If so, what compiled this? Sorry for the noob question, I'm just a little lost.
Looks like a very early dialect. C assumes everything is an int unless specified otherwise. You can declare parameter types after the function name. So: init(s, t) char s[]; { would be equivalent to: int init(char s[], int t) { This still works with modern compilers. I'd be interested if anyone has any more info about this: waste() /* waste space */ { waste(waste(waste),waste(waste),waste(waste)); waste(waste(waste),…
A second, less noticeable, but astonishing peculiarity is the space allocation: temporary storage is allocated that deliberately overwrites the beginning of the program, smashing its initialization code to save space. The two compilers differ in the details in how they cope with this. In the earlier one, the start is found by naming a function; in the later, the start is simply taken to be 0. This indicates that the first compiler was written before we had a machine with memory mapping, so the origin of the program was not at location 0, whereas by the time of the second, we had a PDP-11 that did provide mapping. (See the Unix History paper). In one of the files (prestruct-c/c10.c) the kludgery is especially evident.