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 I met the deadline that message was referring to, but the compiler is certainly “done” now.
I mostly want to talk about the human aspects of 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 competent than me were 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 that 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 for me. 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 scratch as much as possible, and there were a lot of problems I had to focus and think about for extended periods of time. Watching YouTube videos and playing games is much easier to do than thinking hard.
As much as I wanted to force myself to work on a 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. Jonathan Blow's compiler development livestreams were also a source of inspiration.
I got loops and procedures working in December. These two features, along with the support for conditionals 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, every commit felt like real progress.
How it got finished
I graduated from school in 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 compiler presented more and more interesting problems as it matured. Even though I reached my original goal of making an app launcher using my language, I kept working on the compiler because it proved to be an interesting sandbox for me to try out different ideas. The world was my oyster and I had the freedom and time to implement whatever I wanted. 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. Many would probably call it “unmaintainable”, and they would be right. However, I'm still proud of the project. I learned a lot working on this project and part of what I learned was why some of the decisions I made in the compiler were 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 overcome 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 like this again anytime soon. I am thankful for everything that contributed to this unique experience.