PHPPHP: a PHP VM in PHP
21–30 of 52 posts
Re: PHPPHP: a PHP VM in PHP
#22I'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…
Re: PHPPHP: a PHP VM in PHP
#23Re: PHPPHP: a PHP VM in PHP
#24I'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…
With this brillant project, is it the end of nodejs hype ?
Re: PHPPHP: a PHP VM in PHP
#25I'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…
Nope, you probably don't do that. You use a computer (host) where you already have a C compiler, and you compile the new compiler (which you wrote/ported). Then you run this new compiler, on the host, to generate executable code for the new architecture (target), i.e. cross-compile. You can use this cross-compiler to (again) compile your ported compiler, but to run on the target architecture. You end up with a native compiler for your new architecture.
Though, there is no essential need to have a native compiler for an architecture. For example, you can program an AVR microcontroller in C without running any C compilers on the AVR itself.
Re: PHPPHP: a PHP VM in PHP
#26I'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…
> how do you write a C compiler without a C compiler? C is often the lowest-level language compilers are written in, so in order to bootstrap a C compiler for a specific architecture / OS, you need to write the entire compiler in the target language (assembly). Nope, you probably don't do that. You use a computer (host) where you already have a C compiler, and you compile the new compiler (which you wrote/ported). Th…
Ah, yes, I tried to explain exactly that in the last paragraph I wrote. Is what you're describing different from what I described there?
Re: PHPPHP: a PHP VM in PHP
#27Uh, where's all the code? I'm guessing I'm missing something, but a lot of the classes in the lib/ folder invoke classes that I just can't find in the project. Are these external dependencies that weren't called out in the README, or is not all of the code in master actually functional yet?
Which classes are you specifically missing?
Re: PHPPHP: a PHP VM in PHP
#28Earlier quoted context omitted.
> how do you write a C compiler without a C compiler? C is often the lowest-level language compilers are written in, so in order to bootstrap a C compiler for a specific architecture / OS, you need to write the entire compiler in the target language (assembly). Nope, you probably don't do that. You use a computer (host) where you already have a C compiler, and you compile the new compiler (which you wrote/ported). Th…
> Nope, you probably don't do that. You use a computer (host) where you already have a C compiler, and you compile the new compiler (which you wrote/ported). Then you run this new compiler, on the host, to generate executable code for the new architecture (target), i.e. cross-compile. You can use this cross-compiler to (again) compile your ported compiler, but to run on the target architecture. You end up with a nati…
Re: PHPPHP: a PHP VM in PHP
#29Earlier quoted context omitted.
> Nope, you probably don't do that. You use a computer (host) where you already have a C compiler, and you compile the new compiler (which you wrote/ported). Then you run this new compiler, on the host, to generate executable code for the new architecture (target), i.e. cross-compile. You can use this cross-compiler to (again) compile your ported compiler, but to run on the target architecture. You end up with a nati…
Sorry, I missed that, was distracted by your not-really-correct statement above :)
Re: PHPPHP: a PHP VM in PHP
#30The FAQ has it right: For the love of god, why?! (Sure, it's only a fun learning project, i get that)