Not op. Just reposting
In recent months, I have noticed that more and more people are making attempts to create PHP AOT compilers. In particular, recent ones are Elephc (elephc.dev) and TypePHP from the Swoole team (mentioned here several times). Years earlier, I recall attempts such as jPHP and Peachpie, and the most inspiring to me was github.com/ircmaxell/php-compiler. Probably there were a lot more.
However, almost all of them rely on other programming languages (e.g., Rust, C++). So, one day I asked myself, ‘What actually prevents someone from writing the PHP compiler in PHP?’
At this point, I’ve decided I should try even though no one asked. My experience with real compilers is pretty limited, and I didn’t have much time to learn everything from scratch, but in the present times, we have great LLM tools that allows to make some stuff faster.
Then I spent a few weekends making this concept - took the LLVM backend and tried to make a PHP frontend around it. To be honest the most of the “compiler” is AI-coded/slopped and requires heavy refactorings, but I do not pretend to say it is production-ready. It is no more than a working concept with some limited PHP-subset supported.
0 comments
log in to comment.