Bootstrapping a simple compiler from nothing (2001)
homepage.ntlworld.com
homepage.ntlworld.com
[1] http://www.reddit.com/r/programming/comments/9x15g/programmi...
[1] especially kragensitaker's comment http://www.reddit.com/r/programming/comments/9x15g/programmi...
Here's a question I've often thought about that you might have insight on: what would be the shortest path from raw materials and an unlimited amount of information to, say, a reasonable bicycle?
For example: bronze, despite its scarcity, is easier to make from raw materials than steel, but I don't know if it's hard enough for ball bearing races, and I think you need ball bearings for a ridable bicycle. You can probably make a tiny blast furnace with leather bellows and ceramic (or can you?), but then you need to form the bearing balls and the races. Would you cut grindstones from stone? Perhaps electrolyze seawater to get magnesium oxychloride to bind together quartz sand?
Making a bicycle out of bronze would be an interesting exercise. I'd not use ball bearings, but rather babbit bearings and instead of a chain drive I'd use a belt drive (made from cloth).
Bamboo rather than steel or bronze for the frame to keep the amount of metal to a minimum, spokes would be tricky, wheels could be made out of wood.
Inner tubes made out of intestine, outer tubes made out of cloth, bulky but workable.
Something like that?
Now that you have me thinking about this I realize that I'm actually sorely tempted to try this.
Another hard part would be to not (unwittingly) cheat and to work off existing tools and/or raw materials that aren't truly raw.
edit: more thinking about this, the high stress points in the bike would be the spot where the pedals attach (even on my regular bike I can see it flex there), the joint where the tube from the handlebars goes through to the fork, the fork itself and the saddle joint.
Those would probably have to be cast out of bronze and then filed (with what?!) to their precise dimensions, or, alternatively you could first bootstrap a primitive lathe (which would require at least one piece of hardened steel for the bit).
Primitive blast furnaces are fairly easily constructed out of clay, I've seen some in NL that were absolutely doable, depending on what ores you can get your hands at in the end steel might even be easier than bronze.
That's a good point about the bronze. I think there's still a basically unlimited amount of small deposits of rich iron ore out there (e.g. magnetite sands) and, of course, aluminum, but that's a lot harder to smelt.
I had the impression that Babbitt bearings were too inefficient to make bicycles practical, which is why the bicycle boom didn't happen until the invention of the ball bearing. But I could be mistaken about that. Certainly you could do Babbitt bearings without particularly great metallurgy. (But you need a wider variety of metals.)
I know some people here with bamboo bikes, except for the joints, of course.
Spokes could possibly be made of glass or bamboo, but I'm not sure how you'd pull them tight without being able to thread them. Maybe you could lace the wheel like a circular shoe instead.
I don't think cloth tires will wear for long enough to be useful. You'll probably need at least buna reinforced with carbon black or fumed silica.
As for the working off existing tools: maybe you could make it an iterative process, starting with Dave Gingery tools and materials and working your way down with successive bikes?
Do you think you could do a lathe with a non-metal bit? Corundum, carborundum, diamond, or maybe topaz? I've never turned anything on a lathe, so this might be a stupid question.
I think you can grind some things to precise dimensions rather than filing them, and that might require less materials technology. Knife sharpeners use a particular kind of flint for some of their work.
I definitely, definitely want to know if you end up doing some of this!
Grinding / sanding are good ways to get near perfect shapes (it is typically the last pass after the lathe has done its work if you want extreme precision). Ball bearings are made using an interesting process (using a vibrating drum with abrasive, the resulting minimal surface elements are perfectly spherical by definition...).
Babbit bearings have a higher friction coefficient, but we're talking about making a working bicycle, not the most efficient one, after that it is incremental improvements and of course, ball bearings are better but they may not be the shortest path to success.
You've really done a bad thing here, I can't get this out of my head... :)
Today you always have some sort of compiler or cross compiler. Starting totally with nil (not even an assembler) is really not so simple.
This little article shows nicely, how bootstrapping can work. Pulling myself out of the mud on my own hair (like the Baron Muenchhausen from literature).
But don't forget: He still had the operating system not bootstrapped ... so repeating the whole computer history would need some more bootstrapping to do ....
I think the big restriction is how much existing technology you'd be allowed to use, and how functional/scalable the technology would have to be when you're done. I/O is a big hurdle. Do you have to design the graphics hardware yourself? Do you have access to modern photolitography? Are you required to create the monitor/keyboard yourself? Other input devices, like disk drives? Do you need presistent storage at all? Display? Etc.
And though the product would be quite limited, if you're willing to rely on the BIOS doing this from a raw kernel implemented in itself wouldn't be that bad (and having a VM to do so faster would help, but booting off a floppy would still be possible). If anything it might make things a little simpler since you wouldn't have to even use a syscall to get memory, if you set up the pagetables to map to physical memory 1:1 you've got free reign.
And that would definitely be an interesting process to try to take this through.
There are a lot of fine paywalled descriptions of the system. One that's generally available is in the documentation for the EDSAC simulator here (Tutorial Guide, chapter 3):
http://www.dcs.warwick.ac.uk/~edsac/ http://www.dcs.warwick.ac.uk/~edsac/Software/EdsacTG.pdf
Back then, most of my peers could understand that implementation != language.
And as consequence, before Java became mainstream the majority of memory safe languages (e.g. Modula-2, Mesa, Algol,Oberon,...) actually had native compilers in most systems.
Nowadays most don't understand this, nor how bootstrapping works, a technique any CS student should be comfortable with.
Many old papers and documents are now scattered around the web.
You would get to learn a lot from the days C was UNIX only, there was a lot of choice in programming languages and OSs to chose from.
Specially the whole explosion of home computers diversity and respective development environments.
I mused on this topic a few years ago (http://boston.conman.org/2009/11/05.1) only I started without an editor (just a command line on an operating system). But past that, it's neat to see he did something similar to what I proposed.
I have written a simple assembler (that supported labels) using the DOS DEBUG utility, but never had enough time to go through the levels of abstraction beyond that. If I did, my next steps would've been a text editor, followed by a simple C-like compiler.
Another interesting "bootstrapping" problem I've heard of is this: Suppose you rm-rf'd a *nix system, and all that was left was the kernel and shell process running in memory. How much of the system could you "rebuild" with only that?
Exist sometime like this but more high level? For example, I wonder how start with python, lua or obj-c, create my own syntax and continue the development with them after a while.
I think nimrod & julia (and certainly freepascal) do this but wonder how they do that.
https://github.com/darius/ichbins did get to the point of compiling itself, but it was a little too limited to make a good start on growing into a system I'd like to use.
Ironically, this project steps back, abandoning modern utilities in favor of a more educational/interesting process (which is good, sometimes). I too enjoy passion-projects such as this.