Yeah, I'm rewriting my compiler again.
So, it may seem unusually stupid to be rewriting the Epoch compiler again as the core work behind R12. After all, R11 is barely out the door, and surely there's time to do something like, oh, say, make the language a bit more powerful?
Unfortunately, adding more features and richness to the language has hit a point of diminishing returns - not because of the language's completeness (which is not to say it's anywhere near complete), but rather because of iteration time. It's gotten to the point where compiling even the relatively trivial Era source code takes about 30 seconds. This is not acceptable.
R12 will, therefore, feature a rewritten compiler. The VM and remainder of the toolchain will remain in place; all that's really going away is the parser and the AST decoration layer.
Here's an executive summary of the changes coming in R12:
- Replacing boost::spirit::classic with something faster
- Replacing the extensively ad hoc code generation mechanism with a proper AST decoration layer
- Optimizing certain elements of the compiler chain for speed and memory usage
- Implementing separate compilation to further reduce program compile times
Right now I'm playing with boost::spirit::qi, the successor to spirit classic; it reports a roughly 20x speed increase in certain small test cases, but has some downsides. In particular, I can't seem to reliably compile the parser using qi, because it generates so much code that Visual C++ literally reports an out-of-memory error. Moreover, I don't know how well qi scales to nontrivial grammars like that used by Epoch.
So there's a good chance I may bite the bullet and go deploy a more traditional parser generation framework for the next release, because I can't afford to have my tools crapping themselves on relatively straightforward code. I really don't want to do this, because it'll make dynamic parsing a righteous pain in the ass, but what has to be done has to be done.
I hope to improve the ~30 second build time for Era to under a second. That ought to be enough for the next Epoch release, I think!