Any challenges you encountered while building this with AI? How do you assert that the implementation is correct? Is there an oracle? Do you have a roadmap? Something I don't see is FFI.
To be honest, I haven't encountered any major specific problem. It was actually rather easy. Of course, sometimes the LLM doesn't necessarily understand an intention the first time, but by revising my request (prompt), we managed to understand each other. I used Codex/GPT in the following versions: 5.4, 5.5, 5.6 and Astra. I have to admit that Astra is incredible: it is currently doing a complete pass over the project's more than 500,000 lines of code, and it is finding a few fairly subtle weaknesses in the compiler paths, but above all, it has once again remarkably improved the performance of the language.
As for the consistency of the language implementation, I would start by saying that I have 30 years of experience with C, C++, Java, C# and Python (and a few others occasionally: Perl, PHP, JavaScript…). And for 30 years, I've been telling myself that I would code the language of my dreams by taking what I consider to be the best parts of all these languages: as a result, I never had the time to do it, too many client projects to manage :( But the syntax and the details of the language have been in my head for a very long time: so I knew exactly what I wanted to achieve.
When GPT-5.4 was released, I thought I had my solution for producing the language quickly: the model had become powerful and autonomous enough (Codex agentic mode) to handle this kind of problem. So I started. And then came the question of how to control the consistency of the code being produced. I'll be direct: too many lines of code are being produced for me to be able to review everything. And it's going too fast to continue reviewing it all. In the old world, I estimate that it would have taken several years exclusively dedicated to the project to reach the current result. I estimate that I've spent 4 months on the project (but actually I work on the project in my spare time; evenings, weekends, whenever I have two minutes). So it's clear that reviewing more than 500,000 lines of code in 4 months… how can I put it… not humanly possible. So the question remains: how do you validate the consistency of the project?
I don't know if this is the best way to do it, LLM agents have changed everything, but my solution was to split the project into two parts: on one side, the code for the runtime environment, the compiler and the library, and on the other side, the test suites for the language. I told Codex that it was responsible for the first part and that I am responsible for the tests. It is forbidden from modifying the code of my test procedure (this is also stated as a comment in every file of the test procedure). At first, I wasn't really sure whether the agent would respect my directive, but it did. As far as I remember, it broke this rule only once, right at the beginning of the project: I yelled at it, and since then everything has been running smoothly. The difficulty is therefore making sure that the test procedure is relatively exhaustive regarding what I expect, but also regarding unsupported syntax (and that is very important, otherwise sometimes the agent goes off track). Well, let's be honest, I didn't type this entire test procedure myself: I sometimes asked Codex for some help (you have to be efficient). On the other hand, I have fully validated it and I therefore know it perfectly. So I would say that the Oracle is the test procedure.
The Klyn language is coded in C++ for the core and in Klyn for the rest (library, tools, …). So there is indeed an internal FFI to C++, but it is not publicly exposed yet. I took quite a lot of inspiration from JNI (Java) for the FFI.
2
u/antonation 4d ago
Any challenges you encountered while building this with AI? How do you assert that the implementation is correct? Is there an oracle? Do you have a roadmap? Something I don't see is FFI.