aboutsummaryrefslogtreecommitdiffhomepage
path: root/examples/rubyvm-on-php-on-wasm/HelloWorld.php
blob: b23763743b5c3a6ee702d35ecc993a93d2715600 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
<?php

require_once __DIR__ . '/../../vendor/autoload.php';

\define('STDIN', fopen('php://stdin', '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();