The first thing I needed to solve this morning was a miscompile involving constructors. Deeper investigation showed that sum-typed members were to blame. Thankfully, this bug had an easy repro, so I built out a test case and set out to fix it.
A couple of false starts later, things were looking solid.
At 11:51AM PST, the self-hosted compiler passed its first test in the compiler test suite.
It's now time to run the full battery of tests on the shiny new compiler, and see if it passes enough of them to warrant attempting a second-order self-host.
At 12:02PM PST, the self-hosted compiler finished its first complete run of the test suite. There are a few failures, mostly dealing with pattern matching, which has always been the most fragile bit of the language implementation. Some of the failures I'm going to ignore because none of the compiler implementations can pass those tests yet, so it isn't really concerning that the self-hosted one can't either.
I'm not quite ready to proclaim self-hosting a success. The test failures are worrisome, and I haven't done a second-order self-host test yet (where I feed the compiler into the self-hosted version of itself... is this getting confusing yet?).
However, this is a huge milestone. To make sure the implications are clear, this is what happened:
- I wrote a compiler, in C++, which compiles the Epoch language
- I wrote a compiler, in Epoch, which does the same thing, using the C++ version to boot-strap it
- The Epoch implementation of the compiler can compile itself
- This "self-hosted" version of the compiler is almost completely accurate and stable
I still have just over two weeks of padding time before my self-imposed deadline for finishing this project. That should hopefully be plenty of room to solve the last few bugs and get this thing completely done.
For now, though, it is time to celebrate!