bootstrapping from ECHO (SPOILERS)
Kragen Javier Sitaker
kragen at canonical.org
Thu Apr 28 18:54:19 EDT 2011
On Thu, Apr 28, 2011 at 11:07:51AM -0700, Greg Alt wrote:
> I had similar problems that someone mentioned about entering bytes
> with ALT-xxx in dosbox, so I did it in a windows command line window,
> and then switched to dosbox to run it.
Hmm, the only problem I had was with the backspace character, which
apparently was a problem in MS-DOS too. iqlord's post mentioned some
other characters that caused problems, like the 000 you ran into.
It's possible Dosbox on Windows is different from Dosbox on Linux.
> Btw, there are some bugs in the highest level version of my compiler
> that make it choke on compiling complex code in scheme4 (such as a
> scheme4 compiler written in scheme4, which was my next goal). Mostly
> the issue is that I hadn't implemented garbage collection yet and the
> way I compile nested if statements ended up consing way too much.
How much is way too much? Is it exponential or something? That might
cause difficulty with execution time even once you have garbage
In http://canonical.org/~kragen/sw/urscheme/ I still haven't implemented
the garbage collector. But I think it only allocates a meg or two of
memory before it finishes compiling itself, which isn't a big deal on
modern machines. It might be a problem in MS-DOS, though.
> Implementing garbage collection in scheme3, though, turned out to be
> quite a slog. It works, but still seems to choke at a later point,
> and I'm not sure why - and as you can imagine debugging this stuff
> without a proper debugger and error messages is slow going.
I found debugging Ur-Scheme was aided substantially by having GDB handy.
I didn't resort to it often, though, because the emitted code is full of
run-time type-checks, which were usually what failed. And being able to
hit F5 in Emacs and immediately see the diff of the emitted assembly
code, followed by any test failures, was a big help.
StoneKnifeForth <https://github.com/kragen/stoneknifeforth> may be of
some interest to you. I need to fix its ELF header to be able to run on
current Linuxes. Its set of 18 primitives (or 20, or 21, depending on
how you count) are sufficient to implement it, but need to be extended a
bit to support other programs. I suspect that you will find that
compiling Scheme to a set of stack-based primitives is easier than
compiling it to a set of register-based priitives.
> It's definitely been a fascinating project. My goal was to learn some
> higher level abstract concepts about how to think about bootstrapping
> in general - even apart from computers, and I think I've learned a
Can you articulate any of the things you've learned about bootstrapping
apart from computers?
More information about the Kragen-discuss