Creating a Programming language, part 1: Humble Beginnings

Where I started from

I was always sort of interested in trying to build a programming language, but – as usual with most of my projects – I always kinda just forgot about it and moved to the next project. I still do that a lot, and all of my projects are under threat of getting forgotten. That said, I’ve been working on Flower for something like a year and a half. Now I am confident enough that this maybe won’t end up in the scrap pile without showing any results. However, as it’s a hobby language, I don’t have endless hours to spend on it, which is why the development is a bit slow at times.

I don’t have any formal computer science education or training. I do, however, work in the software industry, and I have contributed to various open-source projects – including parts of LLVM. So I wasn’t new to this world by a long shot. It’s been kind of a lifelong hobby of mine.

I had gone through Kaleidoscope tutorial a couple of times with efforts like this but never got much further. What I wanted to build was always so different from Kaleidoscope. I felt like it was giving me a commented example of a small compiler frontend instead of teaching me how to do what I wanted. 

And I was kinda happy working with C++. It did most of the things I wanted and didn’t get in the way while doing them. Sure, I had to write a lot of library code, but much of that was reusable in my work, and I enjoyed making at least somewhat well-thought implementations of basic features which were absent from the C++ standard library. This peace lasted for a long time, and I was content.

The end of an age

But as time passed, I found myself at the place where I followed C++ development pretty closely and compiled my own compilers. I also found some new languages like Zig and Rust and started to follow some language development communities. (And made my own conlang, but not quite sure if that’s relevant)

I decided to give writing my own language one more try and finally got something running that was more to my liking.

And then I figured out that it was garbage.

I would have to scrap almost everything in order to get to the point I wanted to get to. But in the end, that garbage ended up being pretty good manure for the next iteration, which basically is what I’m working with now. It has gone through multiple rewrites, too, but it’s more like a Ship of Theseus now than something completely new.

When I finally got the new compiler to a stage where it could output, at least by some definition, a working program, I decided to do something new.

Why am I doing this?

Even if I end up scrapping this project or can’t get the language working as I want it to, I have been working on it and have learned a plethora of lessons. So I at least think there’s probably something valuable I can offer in the form of stories like this.

What I plan to discuss is a bit more practical story about how the language has changed during the first year of on-off-development, the development choices, the hurdles and broken expectations. They have come and gone while I have been working on the language. Maybe I can give some insight into compiler and language development at the same time. Some things I’ve tried didn’t work out for me, but maybe they could work out or just be interesting for you.

In the next part, I will discuss the ideas behind Flower Lang.

You can see more here: