I'm surprised this wasn't done earlier. It's actually a quite common practice for a language to eventually write a compiler for it in said language; this is called bootstrapping a compiler [1], and makes the language "self-hosted". C is a notorious language in this case, and is the closest to the real chick-or-the-egg problem this is: how do you write a C compiler without a C compiler? C is often the lowest-level lan…
PHPPHP: a PHP VM in PHP
41–50 of 52 posts
Re: PHPPHP: a PHP VM in PHP
#42Earlier quoted context omitted.
Actually (according to Ritchie's description of the history of C at http://cm.bell-labs.com/cm/cs/who/dmr/chist.html ) they never wrote a C compiler in asm. Instead it was a gradual process of evolution, so the first C compiler would have been written in B; and the B compiler was itself written in B and self-hosting, bootstrapped from a B compiler written in a thing I've never heard of called TMG. None of which is to…
Calling B a high level language is something of a stretch.
Re: PHPPHP: a PHP VM in PHP
#43I'm the author of this library. I figured I'd answer a couple of questions as to why I wrote this. First, it was something that I always wanted to do. For no particular reason other than I wanted to do it. I knew it was possible, but possible and doing it are two very different things. Second, it was far easier than I thought. The time to the initial commit (basic working VM) was only about 6 hours of work. So it's n…
Brilliant , PHP source code will need a loads of cleaning one day or another anyway , could help making changes to the language ...
A conforming, but massively improved (read: JIT) PHP interpreter is really the only way forward for us who are so unfortunate. The good news is that there are starting to be viable options in that space.
Re: PHPPHP: a PHP VM in PHP
#44PHP has the wind in its sails or what? last month i got pointed to PH7 ( http://ph7.symisc.net/quick_intro.html ) which is an embeddable PHP interpreter (bytecode compiler + VM) for C/C++/Objective C host applications (amazing piece of work) and now I'm investigating this stuff.
People are collaborating on actually finally decent solutions (Composer, PHPSpec2, Behat). I see people relying less and less upon PHP's bloated, arcane and mostly dangerous standard library, instead building reusable chunks of PHP with surprisingly acceptable (comparably beautiful) design (Goutte, Twig, Doctrine).
Drupal, which I have managed to end end up working with full time for the last few years, has finally stopped (poorly) reinventing everything it touches: http://www.garfieldtech.com/blog/off-the-island-2013 and I expect that trend to continue.
We are starting to have a decent forward-thinking and flexible frameworks and projects like PHPBB have started actually using them.
I've also seen people actually using IDEs, writing docs, specifying argument types and being aware of the concept of stepping debuggers.
Facebook has sponsored enough alternate implementations of the interpreter that I've begun to lose track, charting the massive room for improvements.
Things are genuinely starting to look better; I still lose sleep over my tools and hoop-jump laden development workflow, but I actually have hope that I might not have to by this time next year.
Re: PHPPHP: a PHP VM in PHP
#45I thought this might be a bit similar to PyPy... turns out it's only similar in idea. But hey it looks fun, and as the author said, why not?
https://bitbucket.org/fijal/hippyvm (repo) http://morepypy.blogspot.com/2012/07/hello-everyone.html (article)
Re: PHPPHP: a PHP VM in PHP
#46Earlier quoted context omitted.
Which you can then use to recompile your OS easily (FreeBSD, some Linux based OS's) and tune it to a specific machine / configuration. That's why people like Kernighan and Ritchie (RIP) are so well respected. They wrote C to the target language first (asm) then rewrote C in C once they had a good enough compiler. Considering that C is the cornerstone of UNIX and modern variants I'd say this is no small feat. C will b…
Actually (according to Ritchie's description of the history of C at http://cm.bell-labs.com/cm/cs/who/dmr/chist.html ) they never wrote a C compiler in asm. Instead it was a gradual process of evolution, so the first C compiler would have been written in B; and the B compiler was itself written in B and self-hosting, bootstrapped from a B compiler written in a thing I've never heard of called TMG. None of which is to…
Re: PHPPHP: a PHP VM in PHP
#47Re: PHPPHP: a PHP VM in PHP
#48Earlier quoted context omitted.
Brilliant , PHP source code will need a loads of cleaning one day or another anyway , could help making changes to the language ...
Anyone who could run a non-conforming PHP could just run something better. A conforming, but massively improved (read: JIT) PHP interpreter is really the only way forward for us who are so unfortunate. The good news is that there are starting to be viable options in that space.
Re: PHPPHP: a PHP VM in PHP
#49Earlier quoted context omitted.
Which you can then use to recompile your OS easily (FreeBSD, some Linux based OS's) and tune it to a specific machine / configuration. That's why people like Kernighan and Ritchie (RIP) are so well respected. They wrote C to the target language first (asm) then rewrote C in C once they had a good enough compiler. Considering that C is the cornerstone of UNIX and modern variants I'd say this is no small feat. C will b…
> C will be around for a long time after many of the current languages, domain specific or not, become just another wikipedia entry. Off-topic, but this is a rather amusing benchmark for irrelevance. I suspect that deletionism would not permit it to be true, either.
Re: PHPPHP: a PHP VM in PHP
#50Earlier quoted context omitted.
Nowadays, the same can be said of C.
Nowadays? C was never a high level language except and wasn't designed to be. Mid-level yes. As in just above asm.
You just need to be old enough ;-)