Slashdot Mirror


Ritchie Releases Early Compilers

Slamtilt writes "Dennis Ritchie has posted source for 2 ancient C compilers here. They date from '72-'73, and he says he feels "an element of embarrassment about displaying it", but also that they may be of some historical interest... "

20 of 67 comments (clear)

  1. Re:Quines by Anonymous Coward · · Score: 2
    Actually, it is very simple.

    The world's very first 'C' compiler was written in 'C', it was then 'bootstrapped' by running it through a 'C' interpreter.

    Cute, and effective. K&R were gods in their day.

  2. Another link of interest by Eric+Green · · Score: 2

    Another interesting link is the full two-volume Unix V7 manual, online at

    http://plan9.bell-labs.com/7thEdMan/index.html

    I was gratified to find it there, since my old (printed, Bell Labs original) V7 manuals are yellowed and cracking and on the verge of dying.

    -E

    --
    Send mail here if you want to reach me.
  3. PDP 11 emulators / UNIX V[567] binaries by prumpf · · Score: 2

    can be found at ftp://gatekeeper.dec.com/pub/digital/sim/ . The UNIX binaries you can find there actually include C compiler source code so you could see what changed.

  4. Boy haven't we learned a lot... by sporty · · Score: 2
    No, not being sarcastic. I browsed through the code, and it is kinda impressive. I've never written a compiler before, but I must admit, I see some of the errors I used to make in programming plus some of the inginuity that leads up to today.

    An idea for those with disk space, and some unf.. a software repository for old code?

    --

    -
    ping -f 255.255.255.255 # if only

  5. The login trojan by Squirtle · · Score: 2

    Ken Thompson modified the C compiler to recognize when it was compiling login - it added a trojan.

    He then modified the compiler to recognize when it was compiling the compiler so it inserted the login trojan _and_ the code to modify the compiler when it was compiling the compiler.

    Was it this version of the compiler?

    http://www.cs.umsl.edu/~sanjiv/sys_sec/security/ thompson/hack.html

  6. Lord, lord, I remember those days... by Mr.+Protocol · · Score: 2

    The community was smaller in those days. Also, there was no such thing as IEEE floating point. These two facts combined to put me on the phone with Dennis for about an hour one day, trying to get a PDP-11/45&70 C compiler to compile floating point code on a PDP-11/40 via floating point emulation. It did work, eventually.

    Later, someone came out with a PDP-11/40 C compiler that used 11/40 floating point instructions.

    It was a lot of fun trying to match up C compilers with machines that would "sort of" run them as long as you didn't declare any floating point variables. The compiler itself was "float safe" in that if you didn't declare floating point, it wouldn't use it. You had to use a "-f" flag to compile floating point, though, so that the right library stuff would get loaded to save & restore the floating registers.

    C programmers had to know assembler in those days. Believe it.

    1. Re:Lord, lord, I remember those days... by pedro · · Score: 2

      "C programmers had to know assembler in those days. Believe it."
      My personal feeling is that they should know assembler TODAY, as well, so as to have some frigging idea as to the consequences of their coding. Doesn't hurt to solder up a micro from scratch, using only one's wits and a data book or two, either. I did that in '83 w/a 8085 (my first computer!) and it simply rocks!
      Not to mention the manly confidence that understanding a sytem from the metal up gives one!
      8-}
      Helps when writing fastloaders for C64's, lemme tellya!
      Found a nifty use for that XOR gate on the 1541's ATN line, for sure!
      (if you understood what I just said, you really scare me)
      I've counseled a number of newbies to take this exact tack in their own educations, contrary to popular wisdom, and each and every one thanked me profusely for suggesting it. They eventually ran rings around their classmates, and actually GOT something out of (Acck!) DeVry!

      --
      Brak: What's THAT?
      Thundercleese: A light switch.. of TOTAL DEVASTATION!
    2. Re:Lord, lord, I remember those days... by cookd · · Score: 2

      I agree. I learned 8086 assembly while I was in 5th grade. I grew up with a PC/XT, and I learned about counting clock cycles, using registers, and basically how to milk my 4.77 Mhz for all they were worth. The first time I ever earned money for programming was when I wrote a TSR program for some guy... I've never regretted the time I spent in DEBUG.

      Moving ahead 10 years, in one of my CS classes, the teacher was trying to explain why you can't return a pointer to a local variable. I was dumbfounded, thinking, "duh! It's on the stack, dummy!" But nobody else in the class except for the teacher had ever really done anything with assembly language, and they were pretty much clueless about what actually goes on behind the scenes. In another class, where part of the grade was the speed of the executable, again few people had used ASM, so it wasn't too hard to stay in the top 6 for most of the programs. Nobody else even considered how long it takes to divide, or how to organize the arrays (or use pointers) so that a multiply isn't needed on array access (or at least keep it to one multiply, not two or three).

      On the other hand, the optimizing compilers are making this a confusing issue. Some tricks still work, but I am no longer sure of the fastest way to do things.

      Nowadays, hardware is getting cheaper while programmer time is getting more and more scarce. Often, it seems that it is more important to make the code readable and logical than to make it fast and efficient. Or is that just an excuse...

      --
      Time flies like an arrow. Fruit flies like a banana.
    3. Re:Lord, lord, I remember those days... by pb · · Score: 2

      Um... you badly encrypted a disk, what?

      My first computer was a C64, but I didn't know enough back then to tinker with it on that level.

      I don't solder, but I do read the assembler output from compilers. It's instructive, but no programming teacher in the world would pass me if I wrote code like that... (well, I just knew where the memory was allocated, so I used it, and I knew what the offset was, what's wrong with that? Oh, and those jumps and increments work just like a for loop, what's the problem, really?)

      --
      pb Reply or e-mail; don't vaguely moderate.
  7. This made me giggle. by Cebert · · Score: 2

    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));
    }

    --
    -- www.bteg.com | bleh.n3.net | hac47.dhs.org
    1. Re:This made me giggle. by scrytch · · Score: 4

      Hm. Something else Microsoft embraced and extended, it would seem :^)

      --
      I've finally had it: until slashdot gets article moderation, I am not coming back.
  8. At least someone does care about History by Ektanoor · · Score: 2

    For some reason I can't reach the site. Is it /. effect making its tricks again?

    Anyway the move is fundamental. We have been quite careless on keeping bits of code and source for the future. I do keep some ol'stuff around and probably many people do it. But it looks much like the stuff I forget in the attic.

    It is fundamentally important to keep these things for future generations. Well, it were such things that gave birth to the world we have now. Frankly our frenetic mood of "go forward" and the backward incompatibility games M$ plays, may lead us to loosing the roots where we all stand. What will my granchildren face when they will try to see my life? A few broken pieces of a CD with "Windows 95" labelled? Who was Torvalds? A mad finnish hacker making UNIX to fit in 3 inches?

    I wonder if anyone notes this problem. We are loosing some good pieces of History. Software is highly volatile in terms of preservation. We might have lost already 80% of it. Maybe it is mostly worthless stuff but we all have to keep in mind that no one has a Future without knowing its Past.

    I think it is time to call for such things. To give rebirth to old software. To build museums where one can be able to look at the ol'days. To someone smile on thinking that 15 years ago "I used THAT thing".

    Let's greet Ritchie's move. And also Borland. As /. remarked they have also have done such thing.

  9. Perspective and Teaching by Martin+Foster · · Score: 2

    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.

    I find that this passage is one of the more interesting comments made on the two compilers. Many of the people reading Slashdot (myself included) have probably heard in class of the days when programmers would write code in such a way as to conserve memory, and of course, be as efficient as possible.

    I was once showed a board with a Motorola 6800 (if memory serves) series microprocessor on it, with a hexadecimal keypad and a led display. It had no internal clock which would of make keeping time quite a challenge to someone who is used to simply grabbing it using predefined functions.

    This old code has many a use. Primarily as a teaching tool, make the students looks at the code, and give them specifics on how the compilers worked. In many ways, it's like looking at an antique car, you seem to be able to relate more to what is being taught to you... Since you have something concrete from which to apply your knowledge to.

    Personally, it's hard to imagine a computer functioning without mapped memory... Being able to see that early C compilers functioned without it, to me, brings a whole new perspective to computing. My 0.02c

    1. Re:Perspective and Teaching by Syslevel · · Score: 2

      Bare-hardware programming is quite different from the kind of thing they teach in most schools. I've had to pick up embedded projects started by people used to coding in an Operating-System environment (where, as you mention, time can be determined by grabbing a function). Their code on barebones hardware usually lacks a robust initialization section at startup to properly initiate timers and I/O. When there are NO startup services, and NO OS to call on for anything, you learn pretty fast that every initial condition (i.e. handling the I/O ports on the processor itself, plus startup condtions for any external periperhals) is very important. That status LED will burn up pretty damn fast if you're using low duty cycle high current pulses to drive it (an important way to get optimal efficiency from an LED in a battery operation) and you forget to turn it off as one of the first operations out of the reset vector.

      I have a hard time imaginging handing off memory mapping to some external function. Probably that's why I still live in an Assembly Language world. But I like being in control of what the pins on that sixteen pin processor I embedd code into is gonna do.

      I admit it's anachronistic, of course. But remember that a sizeable proportion of the processors being fabbed are still 4 and 8 bit ones. 64 bit processors barely even make it onto the same chart.


  10. Wonderful news humor by Emil+Brink · · Score: 2

    Dennis announced this over in comp.lang.c, mentioning how he got the compilers off of old DECtapes, and a group regular immediately flamed him (very tongue-in-cheek) for being off-topic. ;^) The entire thread is simply hilarious, if you're into this sort of humor. Check out Dennis' original posting at Deja (News)!!

    --
    main(O){10<putchar(4^--O?77-(15&5128 >>4*O):10)&&main(2+O);}
  11. Re:intresting by Trepidity · · Score: 2

    Yes, slashdot archives itself. After a certain period of time it converts the entire page to a threadless static HTML page (exactly like if you go to preferences and change your view mode to "flat"). It's nearly impossible to follow the discussion in the old pages, but at least all the comments are still there.

  12. intresting by johnjones · · Score: 2

    he noted that he got the source off old tapes which he had carefully archived.

    will the internet be a valid backup device ?

    in the way that letting people have copys of the source? Will that be enough to make sure that the code is safe for all time my gut is saying NO but my head keeps muttering about nodes and US DOD inventing it to survive the BIG one.

    what do you think ?



    a poor student @ bournemouth uni in the UK (a deltic so please dont moan about spelling but the content)

  13. a software repository for old code? by Col.+Klink+(retired) · · Score: 2
    --

    -- Don't Tase me, bro!

  14. Re: disappearance of History by Ektanoor · · Score: 3

    Things were clearly not going well that day over Redmond's Holy See. Supreme Cardinal Gates IX was already up since dawn. While his face kept the pale and emotionless look, anyone could note how nervously he hit the small squares on Minesweeper 4D. When Inquisitor Ballmer IV came in he ordered everyone to leave them alone.

    "How did this happen?" - he asked. Even behind glasses his eyes were icy cold.

    "Well it is an astronomical damn trick that is creating havoc. It seems that gravitational lenses also do have a good deal on reflecting radiowaves..."

    "So?"

    "Well, the deal is that we are getting back radiowaves dropped into Cosmos in the ending of the XXth century!"

    "Damn! - that's the worst problem we ever had since Reno IV had banned paper for the danger of its use by criminals and terrorists... We have to do something with it."

    "Well your Holy Highness we have very little time. As far as I know some people are already in current of the existence of Linux source code. Well we keep claiming that Linus was absolutely mad and the code meaningless. But the worst is about to come. You see, the data that's coming down is nearing the time when US commemorated 30 years of Moon Landing."

    "No one has ever landed the Moon!" - Gates cried while his face looked like if his internal processor became overheated.

    "Well you know perfectly as me that this is not exactly the case. It was your grandfather who wiped out all records about the Moon before 2100, when Surveyor I landed with Windows9999 on it. He tought it would be a great marketing move to sell the new OS with the label: "A small step for a OS a big leap for Mankind..."

    "Well, well, well - ok. I probably got a little bit over my nerves. Anyway that's not too critical. We can explain all that as another blockbuster Holywood made in those times. Anyway people would hardly believe that anyone can rise up from a Microsoft(TM) ChairMouse to take even three steps to the fridge... So what's really worrying you?"

    "Well... uh... Ritchie..."

    "WHAT!!!?"

    "You see the founder of C had published the underlying code he used to create UNIX, somewhere near this time. This can have terrible consequences for us. People will know that there were other languages beyond QuickBasic. They will know about UNIX. They may then link all that with the cryptic meaning of Linux source code. And then they will know that Linus Torvalds was not mad at all..."

    "We are in deadly danger..."

    "What shall we do?"

    "Well pick up the M$ Windows Central MegaServer and blow it up with a GPF. Meanwhile we will explain people that this is due to the CdC and "Richard Stallman" Front guerrillas trying to undermine our society once again. Besides gather every GUI's of those who managed to see Linux code and track them. We need to isolate them from everyone else. As for me I'll try to divert the public from this by making the announcement of the new M$ HyperOffice Application Server."

    Some years later, the M$ MegaServer downtime was noted on M$ Encarta2000 as : "It was not a bug, just a feature"

  15. Re:Wait a second by BigDaddyJ · · Score: 2
    Each new C compiler is written in C and compiled using an older compiler. Obviously, somewhere along the line a compiler was once written in assembly.

    Try getting & looking at the sources to gcc sometime. It's pretty interesting, although monstrous at this point.

    --bdj