31 comments

  • swalsh an hour ago

    I bet claude was hyping this guy up as he was building it. "Absolutely, a rust compiler written in PHP is a great idea!"

  • qalmakka an hour ago

    I think people don't really realise that compilers are "difficult" projects in the same way as an appendicectomy is for a skilled surgeon, i.e. the surgery is "routine" only because the surgeons spent decades honing their skills to do these routinely. The hard part was training someone to be able to do that.

    Writing a compiler/interpreter is _extremely_ straightforward; a lexer -> parser -> ast -> semantic analysis -> {codegen -> linker | evaluator} pipeline is a very widely understood and tested way to write a compiler in any language, regardless of what language you are trying to compile. The hard part is _learning_ how it works, but after that implementing a compiler is a kind of mechanical activity. That's why LLMs are so great at writing parsers: they can just read the source of any compiler (and they probably read all of them) and apply the same stuff mechanically, with almost a 100% accuracy. We even have formal languages to define parsers and RTL and stuff, that's how "mechanical" the whole process can be.

    I'm pretty sure that any skilled compiler dev with the ISO C standard and a few packs of Red Bulls can apecode a working C compiler in a few days, give or take. The hard part isn't doing that, the hard part is the decades of iterative improvements to make it generate extremely performant yet correct code as fast as possible.

  • abricq 31 minutes ago

    > Useful if you need to compile Rust on a shared hosting server from 2008 where the only installed runtime is PHP.

    Not sure if it was meant as a joke or not, but this cracked me up

  • medi8r 17 minutes ago

    Next: A wordpress plugin to compile Firefox to WASM.

  • gregman1 2 hours ago

    You never know what’s going on in someone else’s Claude Max plan =D

    • orthogonal_cube 2 hours ago

      Interesting that both you and nxtfari made essentially the same comment within an hour of each other, though yours is slightly modified

      • tgv 2 minutes ago

        nxtfari is a less than half a year old account...

      • dashzebra an hour ago

        Yeah, right? Are we just... talking with bots?

        • nirui an hour ago

          That's a collision of 64 letters of entropy within 20 mins.

          Searching the term on DDG return this very page as the only result, I can confirm it's not a common term/meme.

          We're living on a dead Internet are we?

  • nxtfari 3 hours ago

    you never know what’s going on in someone else’s claude max plan

  • mohsen1 an hour ago

    Here I thought my experiment with pushing xz to compress Alpine binaries harder was a waste of time / tokens

    https://github.com/mohsen1/fesh

  • dashzebra 3 hours ago

    This is a great example of how people waste our planet's resources faster with AI.

    Seriously, in what world do we need a rust compiler in php? I'd rather have cheap RAM and storage, which I can't because of this kind of stupid idea.

    I wonder how much energy was wasted on this. How many people got poisoned or killed in mines to create the GPUs that spewed out this useless code.

    The fact that we can do something doesn't mean we should. It's time to end this madness.

    EDIT: yeah keep your downvotes coming. Ignore the obvious problem. Easy, it's invisible, just don't think about it.

    • wolvesechoes an hour ago

      But it is not something new that came with AI, even if it is most recent and most visible symptom of the sickness. We keep buying tons of useless crap and convert to tons of trash. We waste tremendous amount of energy for most trivial whims. Frugality was never dominant idea.

    • sunrunner an hour ago

      > Seriously, in what world do we need a rust compiler in php?

      This is described in the README:

      > Useful if you need to compile Rust on a shared hosting server from 2008 where the only installed runtime is PHP.

      So I guess that world? I mean there's working around a problem and then there's working around a problem...

      It would be amusing if, in such a highly limited environment, the compiled binary was still unusable due to restrictions on setting the executable flag.

    • binaryturtle 2 hours ago

      Why do we assume this was created with AI? Is there some marker we can use to detect that?

      • dashzebra 2 hours ago

        The amount of code committed per day suggest some kind of automation.

        Also, a passionate programmer usually will add a "why this exists" in his readme.

        I'd be very surprised if this wasn't AI.

    • nineteen999 an hour ago

      Flipside: how much RAM and storage do you need? What do you need it for? What are you going to fill it with? Vibe code? Porn? Pirated movies? One man's treasure is another's trash I suppose.

      FWIW I didn't downvote you, I don't have much use for a Rust compiler at all, let alone a toy one written in PHP.

      "It's time to end this madness" - this is like trying to shut the barn doors after the horses have bolted and are on a cruise ship that's already sailed, drinking martinis by the pool.

      People are having fun with a new way to code, trying things out they couldn't have ever done before. It's been just over a year since Claude code was launched, blowing the doors off all of the other coding models. Compared to the years of hype around cryptocoins and all the GPU cycles wasted on that, this is a bresh of fresh air for many people.

    • MarsIronPI 3 hours ago

      Why are you assuming this was AI? It doesn't show any obvious indications of being AI. Maybe this is just someone's random side project. I advise you against jumping to conclusions.

      • programmer543 a minute ago

        He also built a 3d engine from scratch using only 2d line function, way before ai:

        https://github.com/mrconter1/IntuitiveEngine

      • scandinavian 2 hours ago

        Just look at the commit cadance, the bulk of the 8k lines of code was added in a couple of hours. Most commits 2-4 minutes apart. This is 100% vibe coded and it's pretty obvious.

        > It doesn't show any obvious indications of being AI.

        I agree that he probably asked the AI to omit some common AI tells, like excessive comments, verbose readmes etc.

        • gitbashr an hour ago

          And then there's me...

          `git commit --amend`

        • gregman1 2 hours ago

          People are weird, I for one started to use em dash more often — look at me!

      • dashzebra 2 hours ago

        Prove me wrong :)

  • wiseowise 3 hours ago

    Are all PHP developers named Rasmus?

    • doctor_phil 3 hours ago

      I also for a second thought this was Rasmus Lerdorf, the creator of PHP. In my head I just have him as Rasmus L-something, so this guy was just a hash collision. :)

  • mike_d 3 hours ago

    Sometimes when doing offensive security work you end up in the strangest environments with limited tools, odd quirks, broken shells, and god knows what else. But you know what is almost always available and just works? PHP.

    • psychoslave 2 hours ago

      Nop. awk, bash or some POSIX shell certainly. Perl most likely, despite it’s plunge in popularity. On a modern Mac, awk, bash and Perl are preinstalled with the system. PHP is not even necessarily present at system level on a PHP dev box as it might be only installed in some container.

  • nasretdinov 3 hours ago

    I wonder if the compiler runs on https://github.com/VKCOM/kphp (a PHP->C++ transpiler)

  • holg 3 days ago

    interesting proof of concept, in php, who would have thought :D

    • devmor 3 hours ago

      I think that proof of concepts are PHP’s greatest strength, actually.

      These days it can be almost as strict as you want it to be, but it’s always been a “loose” enough language that you can implement things that work in very fragile ways and iterate at incredible speed.

      When I am designing PoC microservices that will eventually end up running as Go or Rust, I often start with a prototype in PHP.