Comment by lionkor

20 days ago

Yes a human can hack together a compiler in two weeks.

If you can't, you should turn off the AI and learn for yourself for a while.

Writing a compiler is not a flex; it's a couple very well understood problems, most of which can be solved using existing libraries.

Parsing is solved with yacc, bison, or sitting down and writing a recursive descent parser (works for most well designed languages you can think of).

Then take your AST and translate it to an IR, and then feed that into anything that generates code. You could use crainlift or whatever it's called, you could roll your own.

Meanwhile:

> I spent a good part of my career (nearly a decade) at Google working on getting Clang to build the linux kernel.

https://news.ycombinator.com/item?id=46905771

  • Afaik the Linux Kernel strongly depends on GCC extensions and GCC specific behavior, so maybe that's why this is such an interesting part? Also extensions like inline assembly seem wildly complicated to add to an existing compiler WHILE replicating the syntax and semantics of another compiler (which has a different software architecture).

> Parsing is solved with yacc, bison, or sitting down and writing a recursive descent parser (works for most well designed languages you can think of).

No human being writes a recursive descent parser for "Linux Kernel C" in two weeks, though. And AFAIK there's no downloadable BNF for that you can hand to an automatic generator either, you have to write it and test it and refine it. And you can't do it in two weeks.

Yes yes, we all know how to write a compiler because we took a class on it. That's like "Elite CS Nerd Basic Admission". We still can't actually do it at the cost being demonstrated, and you know it.

  • I wrote a couple hobby compilers. The only difficulty with C is the ambiguous syntax.

    Now compare the article's setup with a single senior engineer who uses an agent or two at the same time.

    • > I wrote a couple hobby compilers.

      So did most of us, join the club. What you can't do is write such a compiler for $20k if you want to put food on the table, or do it in two weeks (what it costs to buy your time currently until AI eats your job). And let's be honest: it's not going to build something of the complexity of Linux either. Hobby compilers run hobby code. Giant decades-old source trees test edge cases like no one's business.

      1 reply →