Run PHP in the browser through Babel
gitlab.com
gitlab.com
https://francisco.io/blog/running-php-in-javascript/
Incidentally it's the #3 when you google "Run PHP in Javascript"
Yes, it's an approximate conversion favoring readable output over exact semantics, so it won't run WordPress. It might still be useful for smaller pieces of code. If you want to rewrite a PHP program in JS (which may be a bad idea…), it will do the most tedious step for you.
I wrote it just as a proof of concept. It was a warm-up before writing a similar tool for C to Rust source-to-source translation:
Another option might be compiling HPHPc, which I dockerized a few years back: https://github.com/allanlw/hphpc-docker
But to answer your question, there's no fundamental difference between interpreted and compiled languages. If the program you want to compile doesn't use `eval`, and you can statically determine all the files it would include, why couldn't you compile it without including an interpreter?
> Babel preset for converting PHP syntax to JavaScript. It can run subset of PHP in the browser or in Node.js. Expanding Atwood's Law.
> Any application that can be written in JavaScript, will eventually be written in JavaScript.
https://blog.codinghorror.com/the-principle-of-least-power/ (2007)
Not really, the MySQL server would need to support something such as webSocket or WebRTC to be able to directly connect to a browser (or just plain HTTP). So you'd still need either to modify MySQL or write a proxy server.
Still, it would have been neat to see this headline read "Run Scheme in the browser through Babel" or similar.
Although, I mostly do javascript today anyway.