Top
Best
New

Posted by modeless 19 hours ago

We tasked Opus 4.6 using agent teams to build a C Compiler(www.anthropic.com)
587 points | 571 commentspage 9
dmitrygr 19 hours ago|
> The generated code is not very efficient. Even with all optimizations enabled, it outputs less efficient code than GCC with all optimizations disabled.

Worse than "-O0" takes skill...

So then, it produced something much worse than tcc (which is better than gcc -O0), an equivalent of which one man can produce in under two weeks. So even all those tokens and dollars did not equal one man's week of work.

Except the one man might explain such arbitrary and shitty code as this:

https://github.com/anthropics/claudes-c-compiler/blob/main/s...

why x9? who knows?!

Oh god the more i look at this code the happier I get. I can already feel the contracts coming to fix LLM slop like this when any company who takes this seriously needs it maintained and cannot...

ben_w 19 hours ago||
I'm trying to recall a quote. Some war where all defeats were censored in the news, possibly Paris was losing to someone. It was something along the lines of "I can't help but notice how our great victories keep getting closer to home".

Last year I tried using an LLM to make a joke language, I couldn't even compile the compiler the source code was so bad. Before Christmas, same joke language, a previous version of Claude gave me something that worked. I wouldn't call it "good", it was a joke language, but it did work.

So it sucks at writing a compiler? Yay. The gloriously indefatigable human mind wins another battle against the mediocre AI, but I can't help but notice how the battles keep getting closer to home.

sjsjsbsh 19 hours ago||
> but I can't help but notice how the battles keep getting closer to home

This has been true for all of (known) human history. I’m gonna go ahead and make another bold prediction: tech will keep getting better.

The issue with this blog post is it’s mostly marketing.

sebzim4500 19 hours ago|||
Can one man really make a C compiler in one week that can compile linux, sqlite, etc.?

Maybe I'm underestimating the simplicity of the C language, but that doesn't sound very plausible to me.

dmitrygr 19 hours ago||
yes, if you do not care to optimize, yes. source: done it
Philpax 19 hours ago||
I would love to see the commit log on this.
rustystump 19 hours ago|||
Implementing just enough to conform to a language is not as difficult as it seems. Making it fast is hard.
dmitrygr 19 hours ago|||
did this before i knew how to git, back in college. target was ARMv5
Philpax 19 hours ago||
Great. Did your compiler support three different architectures (four, if you include x86 in addition to x86-64) and compile and pass the test suite for all of this software?

> Projects that compile and pass their test suites include PostgreSQL (all 237 regression tests), SQLite, QuickJS, zlib, Lua, libsodium, libpng, jq, libjpeg-turbo, mbedTLS, libuv, Redis, libffi, musl, TCC, and DOOM — all using the fully standalone assembler and linker with no external toolchain. Over 150 additional projects have also been built successfully, including FFmpeg (all 7331 FATE checkasm tests on x86-64 and AArch64), GNU coreutils, Busybox, CPython, QEMU, and LuaJIT.

Writing a C compiler is not that difficult, I agree. Writing a C compiler that can compile a significant amount of real software across multiple architectures? That's significantly more non-trivial.

AshamedCaptain 3 hours ago||
Frankly, I think you are exaggerating. My university had a course that required students to build a C compiler that could run the C subset of SPECint (which includes frigging Perl) and this was the usual 3 month class that was not expected to fill in 24h of your time, so I'd say 1 week sounds perfectly reasonable for someone already familiar. Good enough C for a shitton of projects is barely more complicated than writing an assembler, in fact, that is one of C's strong points (which is also the source of most of its weaknesses).
bwfan123 17 hours ago|||
> I can already feel the contracts coming to fix LLM slop

First, the agents will attempt to fix issues on their own. Most easy problems will be fixed or worked-around in this manner. The hard problems will require a deeper causal model of how things work. For these, the agents will give up. But, the code-base has evolved to a point where no-one understands whats going on including the agents and its human handlers. Expect your phone to ring at that point, and prepare to ask for a ransom.

small_model 19 hours ago|||
Claude is only a few years old so we should compare it to a 3 year old human's C compiler
notnullorvoid 14 hours ago|||
Claude requires many lifetimes worth of data to "learn". Evolution aside humans don't require much data to learn, and our learning happens in real-time in response to our environment.

Train Claude without the programming dataset and give it a dozen of the best programming books, it'll have no chance of writing a compiler. Do the same for a human with an interest in learning to program and there's a good chance.

zephen 19 hours ago|||
Claude contains the entire wisdom of the internet, such as it is.
sjsjsbsh 19 hours ago||
> I can already feel the contracts coming to fix LLM slop like this when any company who takes this seriously needs it maintained and cannot

Honest question, do you think it’d be easier to fix or rewrite from scratch? With domains I’m intimately familiar with, I’ve come very close to simply throwing the LLM code out after using it to establish some key test cases.

dmitrygr 18 hours ago||
Rewrite is what I’ve been doing so far in such cases. Takes fewer hours
erfburfl 3 hours ago||
[dead]
myduck_hacker 9 hours ago||
[dead]
hrgadyx 19 hours ago||
[flagged]
falcor84 19 hours ago|
They didn't "steal" open source code any more than I stole my copy of The Odyssey.
sjsjsbsh 19 hours ago||
> So, while this experiment excites me, it also leaves me feeling uneasy. Building this compiler has been some of the most fun I’ve had recently, but I did not expect this to be anywhere near possible so early in 2026

What? Didn’t cursed lang do something similar like 6 or 7 months ago? These bombastic marketing tactics are getting tired.

ebiester 19 hours ago||
Do you not see the difference between a toy language and a clean room implementation that can compile Linux, QEMU, Postgres, and sqlite? (No, it doesn't have the assembler and linker.)

That's for $20,000.

falloutx 18 hours ago||
people have built compilers for free, with $20000 you can even a couple of devs for a year in low income countries.
jsnell 19 hours ago||
No? That was a frontend for a toy language calling using LLVM as the backend. This is a totally self-contained compiler that's capable of compiling the Linux kernel. What's the part that you think is similar?
trilogic 19 hours ago||
Can it create employment? How is this making life better. I understand the achievement but come on, wouldn´t it be something to show if you created employment for 10000 people using your 20000 USD!

Microsoft, OpenAI, Anthropic, XAI, all solving the wrong problems, your problems not the collective ones.

m4ck_ 11 hours ago||
Didn't you hear? We're heading towards a workless utopia where everything will be free (according to people who are actively working to eliminate things like food assistance for less fortunate mothers and children.)
stinkbeetle 5 hours ago||
Who are some of those people?
jeffbee 19 hours ago|||
"Employment" is not intrinsically valuable. It is an emergent property of one way of thinking about economic systems.
wiseowise 5 hours ago|||
That’s the most HN reply ever. Obtuse and pedantic.

Tell a struggling undergrad or unemployed that “employment” is not intrinsically valuable, maybe they’ll be able to use the rhetoric to move a couple positions higher in a soup kitchen queue before their food coupons expire.

trilogic 19 hours ago|||
For employment I mean "WHATEVER LEADS TO REWARD COLLECTIVE HUMANS TO SURVIVE".

Call it as you wish, but I am certainly not talking about coding values.

falcor84 19 hours ago||
I'm struggling to even parse the syntax of "WHATEVER LEADS TO REWARD COLLECTIVE HUMANS TO SURVIVE", but assuming that you're talking about resource allocation, my answer is UBI or something similar to it. We only need to "reward" for action when the resources are scarce, but when resources are plentiful, there's no particular reason not to just give them out.

I know it's "easier to imagine an end to the world than an end to capitalism", but to quote another dreamer: "Imagine all the people sharing all the world".

swexbe 16 hours ago||
Except resources won't be plentiful for a long while since AI is only impacting the service sector. You can't eat a service, you can't live in one. SAAS will get very cheap though...
falcor84 16 hours ago||
Robotics has been advancing very quickly recently. If we solve long-term AI action planning, I don't see any limitation to making it embodied.
mofeien 18 hours ago||
Obviously a human in the loop is always needed and this technology that is specifically trained to excel at all cognitive tasks that humans are capable of will lead to infinite new jobs being created. /s
bsoles 15 hours ago||
The title should have said "Antropic stole GCC and other open-source compiler code to create a subpar, non-functional compiler", without attribution or compensation. Open source was never meant for thieving megacorps like them.

No, I did not read the article...

chvid 19 hours ago|
100.000 lines of code for something that is literally a text book task?

I guess if it only created 1.000 lines it would be easy to see where those lines came from.

falcor84 19 hours ago||
> literally a text book task

Generating a 99% compliant C compiler is not a textbook task in any university I've ever heard of. There's a vast difference between a toy compiler and one that can actually compile Linux and Doom.

From a bit of research now, there are only three other compilers that can compile an unmodified Linux kernel: GCC, Clang/LLVM and Intel's oneAPI. I can't find any other compiler implementation that came close.

cv5005 18 hours ago||
That's because you need to implement a bunch of gcc-specific behavior that linux relies on. A 100% standards compliant c23 compiler can't compile linux.
falcor84 15 hours ago||
Ok, yes, that's true, though my understanding is that it's not the GCC is not compliant, but rather that it includes extensions beyond the standard, which is allowed by the standard, which says (in section 4. Conformance):

> A conforming implementation may have extensions (including additional library functions), provided they do not alter the behavior of any strictly conforming program

Anyway, this just makes Claude's achievement here more impressive, right?

anematode 19 hours ago|||
A simple C89 compiler is a textbook task; a GCC-compatible compiler targeting multiple architectures that can pass 99% of the GCC torture test suite is absolutely not.
wmf 19 hours ago|||
This has multiple backends and a long tail of C extensions that are not in the textbook.
blibble 16 hours ago||
indeed

building a working C compiler from scratch is literally in my "teach yourself C in 24 hours" book from 30 years ago

simonw 15 hours ago||
Which book was that? Sounds excellent.

Might have been Compiler Design in C from 1990. Looks like that's available for free now: https://holub.com/compiler/

blibble 14 hours ago||
it's not that one, but it's in my parents house

you'll forgive me if I don't ring them in the early hours of the morning...

remember C was specifically designed to be easy to compile

(hence anachronisms like forward declarations)