diff options
| author | nsfisis <nsfisis@gmail.com> | 2024-06-30 02:02:24 +0900 |
|---|---|---|
| committer | nsfisis <nsfisis@gmail.com> | 2024-07-04 02:40:27 +0900 |
| commit | a312e95a95d243943535f94653822d6796d4637f (patch) | |
| tree | 74ab3e10cd33d687d2516e20d932f638cf65f2a6 /examples/rubyvm-on-php-on-wasm/HelloWorld.php | |
| parent | 1a1629d6b1d06d5af18987b96eb974c0e7dda75a (diff) | |
| download | php-waddiwasi-a312e95a95d243943535f94653822d6796d4637f.tar.gz php-waddiwasi-a312e95a95d243943535f94653822d6796d4637f.tar.zst php-waddiwasi-a312e95a95d243943535f94653822d6796d4637f.zip | |
feat: RubyVM on PHP on Wasm
Diffstat (limited to 'examples/rubyvm-on-php-on-wasm/HelloWorld.php')
| -rw-r--r-- | examples/rubyvm-on-php-on-wasm/HelloWorld.php | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/examples/rubyvm-on-php-on-wasm/HelloWorld.php b/examples/rubyvm-on-php-on-wasm/HelloWorld.php new file mode 100644 index 0000000..7c37ac2 --- /dev/null +++ b/examples/rubyvm-on-php-on-wasm/HelloWorld.php @@ -0,0 +1,20 @@ +<?php + +require_once __DIR__ . '/vendor/autoload.php'; + +define('STDIN', fopen('php://stdin', 'r')); +define('STDOUT', fopen('php://stdout', 'r')); +define('STDERR', fopen('php://stderr', 'r')); + +$rubyVM = new \RubyVM\VM\Core\Runtime\RubyVM( + new \RubyVM\VM\Core\Runtime\Option( + reader: new \RubyVM\VM\Stream\BinaryStreamReader( + streamHandler: new \RubyVM\VM\Stream\FileStreamHandler( + __DIR__ . '/HelloWorld.yarv', + ), + ), + logger: new \Psr\Log\NullLogger(), + ), +); +$executor = $rubyVM->disassemble(); +$executor->execute(); |
