Part 8 of the 'implementation of Hob' saga.
« Part 7 | Index | Part 9 »

Code-generation is no fun

Or, more precisely, trying to keep a native code-generator working while evolving a language is a major drag. As mentioned in a previous entry, the code generator is quite a hairy component. (Fortunately, it is the only part of the system that scares me at this point.) Almost any change I make to the compiler requires an extension or modification the code generator. While trying to get it to handle branching functions, I got so stuck that development on the language came to a halt altogether.

Of course, the biggest problem here is my perfectionism. A stupid code generator is trivial to do. But I insisted on having clever register allocation, and, having very little experience in that area, just couldn't find a comprehensive way to model that.

Language design is actually much more interesting than messing around with a code-generator. So, today, I put together something that compiles the format my compiler spits out to Common Lisp, and evokes the Lisp compiler on it. Took about an hour to get everything to a point where the testsuite runs again (including a new test that uses datatypes and pattern matching — see the next entry)... and allows me get back to work on the compiler and the language itself.

Part 8 of the 'implementation of Hob' saga.
« Part 7 | Index | Part 9 »

© Marijn Haverbeke, created November 13, 2009