Jump to content

May 2017 »

212223242526 27
- - - - -

Self-hosting the Epoch Compiler: Day Six

Epoch language design
4: Adsense

Tackling problems with a fresh mind makes a world of difference.

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!

Dec 15 2013 02:33 PM

Congrats! That is a very major milestone, and an incredibly heartening achievement to keep up the spirits for the bug fixing ahead.

Dec 15 2013 10:20 PM
At roughly 8:12PM PST, the compiler successfully passed a second-order self hosting test. That is to say:

1. Start with C++ compiler
2. Build Epoch compiler
3. Build Epoch compiler using itself
4. Build another copy of the Epoch compiler using the results of step 3
5. Results of steps 3 and 4 are binary identical

I'm exhausted but really pumped about this. Hopefully sometime soon I can start working on the performance issues.
Dec 16 2013 12:52 AM

Very impressive; gratz, and kudos!

Dec 16 2013 09:34 AM

This is awesome, congratulations!

Dec 16 2013 03:41 PM

+1 awesome dev cred :)

Dec 17 2013 07:57 AM
I thought your project was interesting so I decided to check out your old blog post. I found this one.


This seems like a good language. I wish I had more time to look at it. I'll check it out after I finish my current project, but write now I'm a little to busy. I'll look at some of your other older post to see more of its features.

Note: GameDev.net moderates comments.