I'm making my own programming language

For the last couple of weeks I’ve been really caught up in an idea I’d been putting off for years: I’m trying to make my own programming language. LLMs are a really great help, some things can be done several times faster.

Progress and my observations:

For several years I’d been slowly writing down all sorts of interesting thoughts and ideas about programming languages. If you’re curious, they’re here: “On programming language design”

A couple of weeks ago I dumped them into gemini and talked through various points. What’s really cool here is that the LLM knows a lot, for example I’m thinking about some feature, and the LLM goes “this feature was recently added to OCaml” or “and in the Pony language they did it like this”, and I can go and look at exactly how it’s done there, or done differently, and not reinvent the wheel from scratch.

Then the chat wasn’t enough for me (that’s when I found out there’s no standard way to export a whole chat from gemini, only third-party browser extensions), so I created a project with .md files and started writing in them, sorting different concepts into different files while I was at it. The nice part - a text description isn’t code (and at first it wasn’t that big), so it’s pretty easy for an LLM to edit. The same 20-euro-a-month gemini subscription was enough for me, I used the antigravity ide with that subscription. Over and over I asked the agent what contradictions/incomplete descriptions there were in the project and asked it to write up something more. A funny detail here - I talked to the agent in Russian, but asked for all the descriptions of the language to be in English. English has established programming terminology and rigorous descriptions, and they’re easy to read, but actually discussing things somehow feels easier in your own native language.

In literally a few days the description of the language’s concepts grew to about thirty files, then I asked the agent to describe the language syntax in ebnf notation, then to write a parser for the language and then an interpreter for the AST, so I could try writing code in the language and see how convenient it is and what problems there are. To my surprise, the LLM did it in literally a day. There are definitely bugs in there, and I haven’t even looked at the interpreter code. But my goal right now isn’t to make a “proper interpreter”, it’s just to try writing some code in the language, and as far as I can tell everything’s ok.

Then I got carried away and asked the agent to write an LSP server for the language and an extension for VS Code (the antigravity ide is built on top of VS Code). To my surprise, after a few fixes that worked too. And LSP can give you not just syntax highlighting, but also error highlighting and all those actions like “show variable type, go to declaration, show call sites” and so on, and after a few iterations the agent did that too!

The result - in a week I got a working prototype of the language that you can open right in the ide and write some code in, with working syntax highlighting and all sorts of actions for navigating it. This is freaking awesome. If I were doing this myself without LLMs - I’d probably have spent at least a month.

There are two real speedups: the LLM knows really a lot and you can use it as a consultant - which languages have a feature, how it’s done, what the pros and cons of that solution are. Along the way I noticeably broadened my horizons and learned about a lot of new concepts. And the second - I can delegate the boring pieces like writing a parser / a test interpreter and get them done an order of magnitude faster than by hand.

What I did the second week - nothing much, I was waiting for it all to settle in my head and for new ideas to show up.

The new ideas came from where I didn’t expect - claude opened up access to the top model Fable 5 again, and I tried running it on the language description to write down what needs to be added/improved. I’m impressed with the result - the run produced an answer about five pages long, and the LLM, with a really deep understanding of what’s going on, found a bunch of problems, inconsistencies and ideas that weren’t described in enough detail. It eats tokens very fast, but I think this model is very good precisely at planning. And it seems like giving it a textual technical description is exactly the right way to use it, while programming an interpreter from the language description can be done with a smaller model.

The language itself

I haven’t made the language description public yet, but I plan to soon. Simply because I’m very actively reworking and refining it, and some concepts I’m throwing out altogether.

Briefly, what I want to do in the language:

For now I’m experimenting purely with the language design, without getting distracted by how it’s going to compile.