
A PHP VM implementation written in PHP.
This is a basic VM implemented in PHP using the AST generating parser developed by @nikic
To see what's supported so far, check out the opcodes.
Right now, functions (definitions and calls) are supported, if statements (with basic boolean operations), if statements, as are variables and some basic variable operations...
To see the current state of the implementation versus the Core Language Test Suite, check out the test results file.
To get the dependencies you need to use composer:
curl -s https://getcomposer.org/installer | php
php composer.phar install
Grab a cup of coffee while it runs, as it will fetch the entire PHP source code in the process which can take a while (~10 minutes).
Use the php.sh shell script to invoke php.php. This requires that php be in your system path.
./php.sh -r "var_dump('foo');"
Use the php.bat shell script to invoke php.php. This requires that php.exe be in your system path.
php.bat -r "var_dump('foo');"
You can run the implementation from the command line using the php.php file directly.
php php.php -r "var_dump('foo');"
Or with a file:
php php.php ../test.php
It only supports relative includes off the base file now (no include path parsing yet)...
To run the test suite (which mostly fails right now), install composer using the --dev flag (to install the test suite along side php's source code). Then use the run-tests.(sh|bat) file to execute them.
./run-tests.sh
Before running tests on Windows, some lines must be removed or commented out from runtests.php (if installed via composer it will be located in vendor/php/php-src/runtests.php). Starting from line 185:
if (function_exists('is_executable') && !is_executable($php)) {
error("invalid PHP executable specified by TEST_PHP_EXECUTABLE = $php");
}
To run test suite simply type
run-tests.bat
If you choose not to install php's source code from composer, but have it elsewhere in your system path, you can use it directly.
php path/to/runtests.php -p path/to/php.sh path/to/tests
Major things left to do:
There are a number of reasons why I did this...
Anthony Ferrara - @ircmaxell blog.ircmaxell.com
Nikita Popov - @nikita_ppv nikic.github.com
223 followers · starred Apr 2013
613 followers · starred Dec 2012
935 followers · starred Dec 2012
333 followers · starred Apr 2013

A PHP VM implementation written in PHP.
This is a basic VM implemented in PHP using the AST generating parser developed by @nikic
To see what's supported so far, check out the opcodes.
Right now, functions (definitions and calls) are supported, if statements (with basic boolean operations), if statements, as are variables and some basic variable operations...
To see the current state of the implementation versus the Core Language Test Suite, check out the test results file.
To get the dependencies you need to use composer:
curl -s https://getcomposer.org/installer | php
php composer.phar install
Grab a cup of coffee while it runs, as it will fetch the entire PHP source code in the process which can take a while (~10 minutes).
Use the php.sh shell script to invoke php.php. This requires that php be in your system path.
./php.sh -r "var_dump('foo');"
Use the php.bat shell script to invoke php.php. This requires that php.exe be in your system path.
php.bat -r "var_dump('foo');"
You can run the implementation from the command line using the php.php file directly.
php php.php -r "var_dump('foo');"
Or with a file:
php php.php ../test.php
It only supports relative includes off the base file now (no include path parsing yet)...
To run the test suite (which mostly fails right now), install composer using the --dev flag (to install the test suite along side php's source code). Then use the run-tests.(sh|bat) file to execute them.
./run-tests.sh
Before running tests on Windows, some lines must be removed or commented out from runtests.php (if installed via composer it will be located in vendor/php/php-src/runtests.php). Starting from line 185:
if (function_exists('is_executable') && !is_executable($php)) {
error("invalid PHP executable specified by TEST_PHP_EXECUTABLE = $php");
}
To run test suite simply type
run-tests.bat
If you choose not to install php's source code from composer, but have it elsewhere in your system path, you can use it directly.
php path/to/runtests.php -p path/to/php.sh path/to/tests
Major things left to do:
There are a number of reasons why I did this...
Anthony Ferrara - @ircmaxell blog.ircmaxell.com
Nikita Popov - @nikita_ppv nikic.github.com
223 followers · starred Apr 2013
613 followers · starred Dec 2012
935 followers · starred Dec 2012
333 followers · starred Apr 2013