Ejemplo n.º 1
0
 public function compile(IInputStream $aSourceInput, IOutputStream $aCompiledOutput, ObjectContainer $aObjectContainer = null, $bIntact = true)
 {
     if (!$aObjectContainer) {
         $aObjectContainer = new ObjectContainer();
     }
     // 解析
     $this->interpreters()->parse($aSourceInput, $aObjectContainer, $this);
     // 编译
     $aTargetCodeStream = new TargetCodeOutputStream();
     if ($bIntact) {
         $aTargetCodeStream->start();
     }
     $this->compilers()->compile($aObjectContainer, $aTargetCodeStream);
     if ($bIntact) {
         $aTargetCodeStream->finish();
     }
     $aCompiledOutput->write($aTargetCodeStream->bufferBytes(true));
 }