Problem
lib/Compiler.php has no handling for PHPCfg\Op\Stmt\Namespace_ or use imports. Multi-file web apps typically structure code as:
namespace App;
use App\Router;
require 'bootstrap.php';
Without namespaces, examples/003-MiniWebApp must use global classes only or fragile class_exists workarounds.
Goal
Support compiling PHP files with namespace declarations and use statements into the existing CFG/VM/JIT pipeline.
Tasks
Acceptance criteria
// src/Router.php
namespace App;
class Router { public function route(): string { return 'home'; } }
// public/index.php
use App\Router;
$r = new Router();
echo $r->route();
Runs on VM; JIT/AOT follow when class JIT (#57) lands.
Key files
lib/Compiler.php, lib/VM.php, lib/Runtime.php
vendor/ircmaxell/php-cfg CFG ops
Blocks
Related
Problem
lib/Compiler.phphas no handling forPHPCfg\Op\Stmt\Namespace_oruseimports. Multi-file web apps typically structure code as:Without namespaces,
examples/003-MiniWebAppmust use global classes only or fragileclass_existsworkarounds.Goal
Support compiling PHP files with
namespacedeclarations andusestatements into the existing CFG/VM/JIT pipeline.Tasks
namespaceblocks inCompiler::compileOps(hoist like functions)\Foo\Bar,Foo\Bar) to internal symbolsusealiases for classes and functionsnamespace App+useAcceptance criteria
Runs on VM; JIT/AOT follow when class JIT (#57) lands.
Key files
lib/Compiler.php,lib/VM.php,lib/Runtime.phpvendor/ircmaxell/php-cfgCFG opsBlocks
src/layout)Related