Bratish Goswami

Personal website and blog

Concluding MicroRust

Sometimes the best way to appreciate a difficult thing is to build a small version of it. MicroRust has given me that kind of appreciation for rustc. I admired it before we started; now I have a better idea of what I admire.

In the first post, we chose one program to carry through the series. We've followed its arithmetic and function calls from source text to a linked executable. I'm pleased to have seen those parts come together, and to be able to follow what happens between them.

Keeping source positions through our parser and checker made me appreciate the work behind a useful error message. Lowering expressions into IR helped me understand why a compiler needs different representations of the same program. These are ideas I'd read about before. Implementing them gave me something concrete to compare with the explanations.

Rust's compiler has to preserve the meaning of our code while checking rules such as ownership and borrowing, and still explain problems in terms we can understand. The Rust Compiler Development Guide now feels more approachable because I can recognise some of the problems it discusses.

The linking chapter's complete listing is there to keep and experiment with. It is the same main.rs we've been extending throughout the series. Its portable IR runner and native executable remain separate checks; running the generated executable needs the x86-64 support described in that chapter.

Alexander Pope captured the feeling of seeing further in An Essay on Criticism:

Hills peep o'er hills, and Alps on Alps arise!

I'm leaving this project with more admiration for Rust and the people who build and maintain its compiler.

Thank you for reading and spending this time with me. If you've built MicroRust along the way, I hope you've enjoyed seeing your own compiler come together.