r/Compilers • • 2h 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 🫩

4 Upvotes

19 comments sorted by

7

u/BetterAd7552 55m ago

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

6

u/MithrilHuman 1h ago

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

1

u/Murky-Bus-5922 4m ago

sigh, yeah

8

u/Farados55 1h ago

A lot of people use it in llvm

4

u/Falcon731 1h 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.

4

u/il_dude 1h 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/Honest_Medium_2872 43m 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

2

u/antonation 40m ago edited 37m 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

3

u/criloz 1h 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.

1

u/antonation 20m ago

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

2

u/celestabesta 1h 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.

2

u/r2k-in-the-vortex 1h 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.

2

u/dumael 1h 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/Uncaffeinated 14m 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.

1

u/QuarterDefiant6132 1h ago

It works well, needs guidance but it's helpful

1

u/ralphpotato 1h ago

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

1

u/Discordbothost 1h 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/jcastroarnaud 1h 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.