The first commit I made for my compiler was in 2016, it read “Here’s hoping I get this done in time”. I’m not sure if met the deadline the message was refering to, but the compiler is certainly “done” now.
I mostly want to talk about the human aspects to this project. I find a lot of technical stuff in the project interesting too, but as somebody who is very much a novice at building compilers, I don’t think I bring much to the table talking about compiler construction.
How it started
I started the project in the summer of 2016. As a co-op student, I was supposed to intern at a company. Everyone seemed to have found jobs for the summer, but I didn’t. I felt really bitter that people who I considered less compotent than me was able to find jobs while I was left jobless. I felt the need to get better, I felt resentment.
Thinking back, the reason I didn’t find a job was probably because I started searching too late; most companies have filled their internship quota by the time I started looking. It turned out that resentment wasn’t a very effective fuel. I would put in an hour of work every day, even though I basically had nothing else to do. I wanted to build the compiler from the scratch as much as possible, and there were a lot of problems I had to focus and think about for an extended period of time. Watching Youtube videos and whatever is much easier to do than thinking about hard problems.
As much as I wanted to force myself to work on project so I can impress potential employers, not much work was done on the compiler during the summer of 2016.
Reboot and critical mass
I stopped working on the compiler when the summer ended and didn’t work on it at all for most of 2017. In December of 2017, I got the idea to work on the compiler again. I wanted to prove to myself that I can build a compiler, I also wanted a sort of souvenir for my time at the university. I was also inspired by Jonathan Blow and his compiler development livestreams.
I got loops and procedures working in December. These two features, along with the ifs I implemented in 2016, made the compiler feel tangible and actually sort of usable. Working on the compiler didn’t feel like a drag anymore, because there was reassurance that as long as I kept going, I can get closer to the finish line.
How it got done
I graduated from school April of 2018. I had the privilege to take a 4-month break before starting work, so I used a lot of that time on the compiler. The project got more and more interesting as I worked on it since I discovered many directions I could explore. I could’ve called the project “done” halfway through my post-grad break. I had the app launcher working, but I kept working on code generation. Any direction I wanted to take the compiler felt tangible and reachable. I had fun working on the compiler.
Was it worth it?
I am proud of my compiler. The code is nothing I would consider exemplary and many would probably call it “unmaintainable”, but I’m still proud the project. I learned a lot working on this project and part of what I learend was why some of the decisions I made in the compiler are terrible. If I were to work on this compiler again, the first thing I would do is rewrite many parts of it.
I feel that I have overcame many obstacles and came out of the other side with two pieces of real, usable software. souvenir, the application launcher I made using the compiler, is installed on my machine at home and I use it every day.
I think I will always look back at the time I worked on the compiler fondly. Not many people get to write software just for the sake of it and I doubt I will get to do something similar anytime soon. I am thankful for all the things that contributed to this unique experience.