TypePHP 编译器 https://swoole.com/aot/
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 

19 lines
448 B

<?php
require __DIR__ . '/bootstrap.php';
use PhpAot\Php\Translator;
if (empty($argv[1])) {
die("php compiler.php [file]\n");
}
try {
$file = $argv[1];
$translator = new Translator(ROOT_PATH);
$info = pathinfo($file);
$objectFile = './tmp/' . $info['filename'] . '.cc.o';
$translator->compileBinary($info['filename'], $objectFile);
} catch (Error $error) {
echo "Parse error: {$error->getMessage()}\n";
return;
}