aboutsummaryrefslogtreecommitdiffhomepage
path: root/examples/rubyvm-on-php-on-wasm/HelloWorld.php
blob: 7c37ac2a274bcb2ee85410f9f6e170726472632a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
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();