3 ms·
If you really want to understand how things work from the very bottom, you can build a toy computer running on FPGA, there are some very cheap boards available
by sklogic 12y ago
If you really want to understand how things work from the very bottom, you can build a toy computer running on FPGA, there are some very cheap boards available now.
To make things even more interesting, you can write your own HDL compiler (into netlist, of course, anything lower level is, unfortunately, too proprietary).
From this point you can build up your abstractions. The shortest route to the high level you're already comfortable with is to implement Forth first, since it's very easy to build a simple stack-oriented machine on FPGA, see ( http://www.excamera.com/sphinx/fpga-j1.html http://www.excamera.com/sphinx/fpga-j1.html ). Running your own Forth on top of such a CPU is easier than on something like x86.
Next step is to implement a Scheme compiler and runtime in Forth. Garbage collection can be somewhat tricky, but if you go for something trivial, like stop-and-copy, it won't take long to implement, especially if you have some assistance from your hardware.
Three totally manageable steps from the very bottom of the abstraction ladder - and you've got Scheme, an extensible, powerful meta-language, from which you can grow anywhere.
I recently wrote this bit on bootstrapping a Lisp-like language using the most trivial interpreter possible: https://combinatorylogic.wordpress.com/2015/01/14/bootstrapping-a-compiler/ https://combinatorylogic.wordpress.com/2015/01/14/bootstrapp... - you can find this approach useful, I did a similar thing on top of Forth and it was very easy, much easier than trying to implement a "proper" interpreter.
And once you know how to build the whole thing from the bare silicon, there won't be any place for "magic" in your understanding.
- deleted 12y ago[deleted]
- ido 12y agoIf you really want to understand how things work from the very bottom, you can build a toy computer running on FPGA, there are some very cheap boards available now. You don't even have to go that far, you can build something resembling the cheap early 80s/late 70s computers from off the shelf chips and 8 bit CPUs that are still sold (z80, i8051, 6502). e.g. http://www.grappendorf.net/projects/6502-home-computer http://www.grappendorf.net/projects/6502-home-computer These chips are simple enough that you can basically hold the whole thing in your head.
- sklogic 12y agoOf course, it's also a very useful experience. It'll just be a bit hard then to go all the way to the high level - i.e., memory-hungry, garbage-collected, with elaborate, computationally intensive compilation. For this you'd need a bit more modern device with enough memory attached. At least something around 16Mb would be nice if you want to implement a decent Lisp. With z80 you'd likely be forced to stay at around C or Basic level of abstraction.
- ido 12y agoPretty sure a 10mhz z80 with 64kb ram can handle a small forth or scheme dialect just fine (You'll have to program those interpreters in asm or c though!) :) It won't be useful/"pragmatic" but I don't think that's what we're after here anyway.
- sklogic 12y agoYes, but this way you'd need some magic - an external C compiler or at least an assembler. Instead of implementing everything from scratch, with most of the code developed on a board itself.