r/Compilers • • 15h ago

How many of you here use AI for compilers?

Just curious. Often see people who use AI assistance or who just vibecode whole project. And on the other side I often see people who hate any AI usage.

How many of you here use AI in any case (would like to know in what case btw)? What is your criteria(s) to trust AI in compilers engineering?

Sorry for English, not my native language. Thanks for your attention

EDIT: Why downvote, just a basic interest 🫩

23 Upvotes

40 comments sorted by

52

u/BetterAd7552 14h ago

Based on the number of recent “I built x” posts, I’m guessing many.

12

u/seg_lol 12h ago

It will take a couple years for this to die down. I was standing there when the agent pooped out a couple Python and Scheme compilers but I didn't run around with that poop in my hand demanding that everyone look at it.

The LLMs make amazing tutors to each all aspects of compilers, and with their hand holding, all students can have their own working compiler that they should be able to explain every internal aspect of.

24

u/MithrilHuman 14h ago edited 10h ago

Company forces use of AI for maintaining our compiler. Not using AI assisted coding = low performance.

edit: Big tech FYI. You focus more on system design and algorithms, less on reproducing issues and writing code. Writing small parsers or small fixes for the compiler is trivial for LLMs but providing direction to AI and making the slop maintainable is on you. This is the norm now, work is not supposed to be romantic. We use any tool available. You can avoid AI for your hobby and learning projects though.

1

u/Murky-Bus-5922 13h ago

sigh, yeah

1

u/antonation 11h ago

Businesses are typically driven by customer value and the profits made from delivering that (or in some cases, locking customers into ecosystems lol). Code is only a medium. If something can churn out code within bounds, then the primary foci become higher level things like architecture as you observed. Work is work in the end.

edit: additional thoughts

1

u/Bruoche 11h ago

I'm curious but in what cases do one work on a compiler in a professional setting? Unless it's like a public part of the activity like Go is at google, having a proprietary compiler to maintain in the company sound like it'd easily be a nightmare long term

5

u/MithrilHuman 11h ago edited 10h ago

I work on a custom edge AI inference accelerator. Also a Pytorch compiler. Previously I worked at an Android GPU maker. Compiler is for the architecture.

13

u/Farados55 15h ago

A lot of people use it in llvm

12

u/Falcon731 14h ago

I generally used it to generate test cases, and as a rubber-duck to discuss ideas with, and get code reviews. But all the code itself is written by me. The whole point of a personal project like this is to get the sense of accomplishment when something works.

On the other hand I totally vibe-coded the VSCode extension for my language. I have no real interest in learning the VSCode API - But I did want the feel of a "proper" language with semantic highlighting, goto definition etc.

0

u/seg_lol 12h ago

I bet the LLMs could vibecode an entire intellij plugin as well. That would get you refactorings.

22

u/Honest_Medium_2872 14h ago edited 11h ago

I'll fess up because everyone else wants to be a priss about it.

The last few months I've been working with Claude & Gemini to develop a new language and compiler toolchain called kura - https://github.com/s0cks/kura

The experience is....interesting. In some ways its helpful, Gemini is pretty good at analyzing IR dumps and identifying ways to improve. Claude is great at boilerplate.

Recently I've been exploring how to integrate something like lean or dafny into my workflow to spec out what I want claude to build.

One thing I can appreciate LLMs for is kinda analyzing my options when i want to add a new feature or investigate some kind of paradigm or pattern. Being able to talk it through with the various LLMs and get fresh ideas or find places where theres friction - far before I ever write any code is a godsend.

I stand by this, AI written code is trash a lot of the time, but any dev telling you "oh its just AI slop" or mad because you used AI is a dev thats going to get left behind when the world progresses. Its no different than other tools like LSPs, Assemblers, IDEs etc.

I've been writing toy languages for well over a decade:

integrating LLMs into my workflow to improve velocity and accuracy hasn't been easy but it has been worth it

5

u/cartazio 12h ago

it doesnt automate taste.  but if you have taste and clarity, shit gets nice when can get ideas and designs out of your head this quickly

3

u/m-in 11h ago

I trust AI in this area because I have tests, sometimes formal proofs of correctness, and the damn thing compiles itself just fine and works :)

7

u/paulhaahr 13h ago

My current hobby project is wholly LLM-written compiler that resurrects a dead programming language. The language is Quest, which Luca Cardelli described in Typeful Programming (1989). I'd read the paper at the time, which introduces what was, at the time, a very powerful type system that unified parametric polymorphism with subtyping, and was fascinating by the language used to describe the ideas. As far as I know, no implementation was ever made public (and the papers even described it as only partially implemented), so I never had a chance to play with it.

Over the years, I had started to implement it once or twice, but never could put the time into it and dropped things along the way, typically getting bogged down in type checking. But I was looking for a project that I could use to experiment with agentic coding – specifically, could I use models build something of reasonable size that was well-designed and readable? – and Quest felt like the right thing.

It turned out to be a great project to tackle this way. I started having the models build a bootstrapping interpreter for the language in Python, then turned that into a transpiler to C. From there, I had it move the interpreter and transpiler to self-hosting in Quest. Then came an SSA-based IR and generating Arm64 code, followed by a JIT compiler, which makes the REPL feel zippy. I was curious about Web Assembly, so I had the models build a WASM backend. (You can try out the WASM REPL.) One good thing was that the models were great at writing tests for every stage along the way. (One bad thing was that the pre-Carbon Gemini models would try to fix tests by changing the tests to comply with the broken implementation.) Getting the models to offer pros and cons on technical approaches was invaluable – they've read much more of the compiler and language implementation literature than I have – and that enabled me to ask better questions.

One of the reasons I picked Quest as a project was that I didn't want to be doing language design, because that would have been one too many degrees of freedom. With a small number of exceptions (mostly adding a hierarchical namespace for modules), I kept as close to the language as Cardelli had described it as possible. There were times I'd look at the code or try things out and have to ask the model "Do the original papers really say that?" Forcing the models to act as a language lawyer was helpful and there were at least as many times they corrected my understanding as I corrected theirs.

Quest is not a language I would design today – it's missing a lot of ergonomic features any modern language will have – but I was very curious about how the models would deal with writing code for a language where there's almost zero extant code in their training data; I could find almost nothing other than three papers by Cardelli, with a few hundred lines of code in the language across them. In general, that seemed not to be a big deal for the models; maybe they burned more tokens writing Quest than Python or Javascript, but the code is fluent and, with a little prompting, the models were coming up with elegant idioms consistent with the original paper. For library designs, they seemed to model things on Python, Go, or Java, with some guidance from me. A few quirks in the language differ from most other languages – a lack of operator precedence for infix operators is the biggest – and the model kept getting tripped up on those things. (To be fair, so do I.)

I worked professionally as a compiler engineer in the '90s (mostly middle-end, on Dylan at Harlequin and as part of a small contract team that built Java bytecode backends for a server company) and what the models are capable of is just astounding. The implementation of high-level languages is something I've thought and read about for years, so I can confidently say that I could have written any individual piece of it, with sufficient reference to books and papers, but each major piece would have taken me weeks or months. Compared to how we were writing compilers thirty years ago, I can see staff years worth of work getting done in a weekend.

I'm using it now for Advent of Code (my solutions so far), where I'm writing everything by hand, artisanally. Writing code in Jupyter notebooks in a fast, type-safe language is actually quite a blast, but I'm a lot slower than the models. And Advent of Code is probably where this project will end for me – my Quest implementation does everything I wanted when I started and more. I feel I've learned about as much as I can from it. My main takeaway is that agentic coding has changed everything; I can't imagine working on a coding project, compiler or other, as a hobby or in my professional life, where I'm writing all the bits by hand.

Quest repository: https://github.com/haahr/quest

2

u/AustinVelonaut 12h ago

on Dylan at Harlequin

I was at Apple (PowerPC processors) during the time of Dylan development. Too bad Dylan never really made it -- I liked the ideas behind it, but it was too slow for the Newton so they went with plan-B.

2

u/nrnrnr 11h ago

Paul? This has to be you.

You may have just got me over the hump for an experiment I've been thinking about: a statically typed functional language with the convenience of Lua. -NR

1

u/paulhaahr 9h ago

Of course it is. Unique name and all that. Good to hear from you.

I find it very exciting that we can now build out what used to be just thought experiments in a very small amount of time and effort. So I'd encourage your project. I would like to play with my own design in my next project, but that many degrees of freedom could make it harder to get to closure – it was a nice constraint to stay to someone else's definition.

It is a bit odd, because I am thinking in terms of designing programming languages for people, without really being sure that's an audience that continues to exist.

1

u/nrnrnr 5h ago

Yes, that's a showstopper. I'm still at the stage where I have to remind myself to question my assumptions. And now I am also questioning my experience. I just shipped a project I started in July 2025, and the difference in the coding agents between now and then is astonishing. My future is going to require me to unlearn a set of things that the LLMs are used to be no good at!

1

u/nzconstructionlawyer 11h ago

That's fascinating. I'm not surprised that the LLMs can write code in languages that basically don't appear in their corpus. We can learn new languages, why wouldn't LLMs be able to? The thing is just that it'll take a while to work out what the idioms should be in the new language.

4

u/il_dude 14h ago

For me, when it's about projects I like to understand myself, hit the wall and bug fix, I prefer thinking and writing code on my own. I ran Claude over my compiler and spotted a bunch of bugs. So it could be helpful for those things, but not to steal the fun out of implementing algorithms or ideas.

3

u/antonation 13h ago edited 13h ago

I use AI for writing all of my compilers (https://github.com/antonsynd/sharpy and https://github.com/antonsynd/sabiko). The important thing for me is that I have comparable oracles from other related languages to ensure the behavior I want is there. That and a hand written or human reviewed spec. It's not perfect but it's enabled me to do things I couldn't do myself.

I work at one of the big tech companies and we use AI pretty much for everything, code generation, code review, design doc drafts, slides, you name it. Sometimes the AI is writing messages to other people on Slack or on bug reports. Outside of work, I use it in all my (non-compiler) projects pretty much.

edit: added non-compiler uses

5

u/criloz 15h ago

I was reluctant. At first I had been working in my language for, like, 8 years and was stuck in many places mostly because of the grunt work, and then I have been using Claude and DeepSeek. For the last month I have been able to test many dump ideas and get the real picture of the pieces that I was missing, which, otherwise, will probably take me another year or two, and I really close to making the first working version of my interpreter and later compiler. But It has no vibe code; I just discuss a lot with Claude, and then when something is settled, I ask for it to be implemented and see how it works. Claude also tends to end up creating patterns that really don't fit my language, so I need to carefully guide it because otherwise things get out of control. Also the page was assisted by a clause; there is just the basic, even when most of my professional software career was being a frontend dev. But still creating a page from 0 is a lot of work that takes a week or 2 and with Claude you can iterate fast and get something decent in just one day. https://tagkyon.com/

I still think that you need to understand the deep concept more than ever if you want to still be in control of what those llm produce, I still understand all the codebase; the most important parts are developed very closely supervised, while other things, like making every error report look good or creating 100 tests about X features, can be delegated to agents.

It is sad that people take so extreme positions, like all in or none of it. For example, in r/ProgrammingLanguages I cannot say anything about my language anymore. I understand their reasoning because of the noise created by some people, but it is still sad, and there should be other alternatives.

2

u/antonation 13h ago

There are. I mod r/VibeCodedLanguages and another person has r/AIProgrammingLanguage

2

u/nzconstructionlawyer 11h ago

But he doesn't want to discuss vibe coding or AI, presumably. He just wants to discuss programming languages.

1

u/rantingpug 12h ago

I agree its sad that sub has such a hostile policy. Plus the mod has like a vendetta and applies the rule inconsistently. That said, i do agree the never ending flood of slop projects was incredibly frustrating. I really dont get people who just prompt "build me a lang" and are done with it. I personally use AI because it allows me to prototype SO MUCH FASTER. But i still have to spend an enormous amount of time of the architectural and engineering decisions; that's the fun of it, and i get to do it far more now that constantly being annoyed at the sheer amount of boilerplate and grunt work i'd have to do to get something going.

Compilers are hard...

3

u/r2k-in-the-vortex 14h ago

https://github.com/r2k-in-the-vortex/stc

Here we go. Worked out pretty well so far.

And no, you don't trust, you verify. The entire pipeline is specced in lean and tested against that spec. I don't have very serious concerns for compiler correctness given that. If it were more than a personal project, I would rewrite the entire pipeline so it would not only be tested against spec, but fully proven eqvuivalent to it. As it is, that is done only for critical core part of it. It's money limit, I would rather spend tokens on other features than on what I see already working just fine.

3

u/jcastroarnaud 14h ago

I don't like LLMs in general. Tone too confident, has no sense of truth/falsity, fact/fiction, or common sense, knows nothing about what it writes, any answers can contain subtle or obvious errors.

For my interpreters and stories, I don't use LLMs at all: my work is the expression of my creativity, and a means for me to learn, the hard way, the concepts I don't have. I abhor the idea of outsourcing anything to a know-nothing bot.

For other projects, I seldom use generative AI, mostly for things I'm unable to do, like generating images from a prompt, and it's an uphill battle: many prompts I give are promptly (heh) misunderstood by the AI, because it doesn't have knowledge, beyond how to write according to the statistical patterns learned at training.

1

u/cmontella 10h ago

Yes! They are very good at optimizing, here's an example of an LLM which optimized a compiler 222x over 50 hours to be faster than Rust at a particular benchmark. I'm exploring how this capability generalizes and can be exploited -- it should go faster as these models and hardware advance, to the point maybe it can happen in real time.

https://mech-lang.org/benchmarks/mech-compiler-optimization-60fps.mp4

1

u/Revolutionalredstone 9h ago

Yes.

My cpp compiler CPrime is fully cpp17 compatible and leaves clang and msvc in the dust.

In its latest form it is fully self generating from English specs along and works using only simple open source AI models.

Even LLM is laggy human slop.

Pro up scrubs.

1

u/Trave11er3427 8h ago

I designed Enzvn (envzn-lang.org) long before AI came about. While I wrote some of the code before 2026, this year I incrementally starting using Claude first for research, then for testing, and now I use it extensively for design, coding, and testing, but in “zero trust” framework of my own harnesses. I have to test things 3 different ways to make sure Claude was thorough in the work I asked it to do.

1

u/Inconstant_Moo 4h ago

Not for the compiler. I tried getting the free thing in VSCode to fix what turned out to be trivial bugs, and its misconceptions about the whole nature of the problem were hilarious, as was the way it would burn up a whole month's tokens chasing its wild geese.

The random nonsense it did to my code in pursuit of fixes and/or diagnoses was less hilarious. It was havoc. I can't trust it.

I've been using free-tier ChatGPT to write bits of the spinoff frontend web framework, Klee. It's particularly useful for writing CSS because it is not human and has no soul. I need to tell it exactly what I want from it because all of its independent thinking is really stupid. It is terrible at software engineering, and it doesn't know what users would want. However, there is a crossover point where if code is precise and limited enough in scope, it will not only do it a hundred times faster than I would but also with fewer bugs.

I do, oddly enough, feel kind of sad that it can't take any satisfaction in doing what I can do, that it would mean nothing at all to it to tell it that it's a good bot. Instead I just say. "Our next subgoal is ...", and move on.

1

u/Physical_Dare8553 1h ago

while i understand why people dont like using ai for compilers -- first hand as well, ive seen the horrible code it creates and the impossible bugs that get introduced, things that no human would ever cause -- i cant resist pressing the win button. how am i supposed to spend hours implementing a language i'm not sure of? i get that this is a learning experience and all that, but seriously, it replicated the work that took me months the first time in some hours. and those aforementioned bugs, who cares if they get fixed in 30 minutes as well? i still intend to rewrite the compiler manually at some point of course, but the part between me thinking of something and some version of it existing seems to have been completely eviscerated.

1

u/dumael 14h ago

I have used it to write out the code for some fairly mechanical transformations. E.g. intrinsic expansion in LLVM.

It's also been useful in expanding some code I have previously written that was in an incomplete state.

My trust of it middling given that I have found Claude will sometimes try to suggest transforms later in the pipeline than I would like.

One key to being able to trust it is having a substantial test suite to validate changes.

Also, rather vibe-coding a pass or problem is to feed the problem piecemeal, so it can actually be reviewed for style and structure. E.g. ensuring Claude doesn't attempt to weave separate cases in a single path with a load of if statements, rather than top level branching.

1

u/QuarterDefiant6132 14h ago

It works well, needs guidance but it's helpful

1

u/ralphpotato 14h ago

I used AI for mine. Works pretty well. https://redextape.com

1

u/Discordbothost 14h ago

Write the expected test results from the language spec, independently of the generated implementation. For IEEE floats without fast-math assumptions, x * 0 can't always become 0: NaN * 0 is still NaN. That gives you a concrete check beyond whether the generated tests pass.

1

u/celestabesta 14h ago

I've written the vast majority of my compiler on my own. I use LLVM currently, but I am planning on writing my own x86 backend. Then, I'll have an AI write several different backends based on the x86 one.

It seems reasonable to assume that, if supplied with an x86 backend and a (say, ARM) document, an AI could create an ARM backend close to how I would've done it myself.

1

u/Uncaffeinated 13h ago

My most recent language, 1SubML, was written back before AI got good enough to be really useful at coding, and in any case, I like to be hands on so I can maintain understanding of the project and impose high quality standards. However, I did vibecode boilerplate stuff like the test runner and I'm currently working on vibecoding a Lean formalization of the compiler.

0

u/ElephantElectrical31 11h ago edited 10h ago

Nikaia >99,9% witten by AI and proud of it.