192 points · by emersonrsantos · 12y ago · 30 comments
[1] http://www.reddit.com/r/programming/comments/9x15g/programmi...
[1] especially kragensitaker's comment http://www.reddit.com/r/programming/comments/9x15g/programmi...
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 ....
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 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.
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.