rename(project): refactor Swoole-Compiler to TypePHP

- Rename project references from Swoole-Compiler to TypePHP in documentation
- Update command line usage from php bin/compiler.php to ./tpc
- Change application name constant from Swoole-Compiler (AOT) to TypePHP
- Update file descriptions and metadata in project.yml
- Modify Windows packaging script title to TypePHP
- Replace all copyright headers to reference TypePHP instead of Swoole-Compiler
pull/15/head
韩天峰 2 months ago
parent 995d23cfc8
commit 777d6b6c36
  1. 8
      .github/copilot-instructions.md
  2. 4
      CLAUDE.md
  3. 2
      package-on-windows.php
  4. 8
      project.yml
  5. 2
      src/Php/ArgInfo.php
  6. 2
      src/Php/AstNodeType.php
  7. 4
      src/Php/CompilerBase.php
  8. 2
      src/Php/CompilerTest.php
  9. 2
      src/Php/Constants.php
  10. 2
      src/Php/Extractor.php
  11. 2
      src/Php/FileScanner.php
  12. 2
      src/Php/MagicMethodDetector.php
  13. 2
      src/Php/Preprocessor.php
  14. 2
      src/Php/Reflection.php
  15. 2
      src/Php/Symbol.php
  16. 4
      src/Php/Translator.php
  17. 2
      src/Php/Visitor.php
  18. 4
      src/compiler.php
  19. 2
      src/functions.php
  20. 2
      src/polyfills.php

@ -2,7 +2,7 @@
## Project overview
Swoole-Compiler is an AOT compiler that translates PHP source into C++, then compiles and links it into a native binary or a PHP extension. The primary entrypoint is `bin/compiler.php`, which boots `src/compiler.php`; that drives `PhpAot\Php\Translator` through a fixed pipeline:
TypePHP is an AOT compiler that translates PHP source into C++, then compiles and links it into a native binary or a PHP extension. The primary entrypoint is `tpc`, which boots `src/compiler.php`; that drives `PhpAot\Php\Translator` through a fixed pipeline:
1. `prepare()` scans files, parses ASTs, collects symbols, and topologically sorts PHP files by cross-file symbol usage.
2. `convert()` turns PHP ASTs into generated `.cc` files while passing through native source files (`.cpp`, `.c`, `.s`, `.m`, `.mm`).
@ -30,9 +30,9 @@ make -j32
Compile a project, directory, single file, or `project.yml`:
```bash
php bin/compiler.php <path-to-project-or-file>
php bin/compiler.php <path> -O2
php bin/compiler.php <path> --mode=ext -o <output_name>
./tpc <path-to-project-or-file>
./tpc <path> -O2
./tpc <path> --mode=ext -o <output_name>
```
## Test commands

@ -4,7 +4,7 @@ This file provides guidance to Claude Code (claude.ai/code) when working with co
## Project Overview
Swoole-Compiler is an AOT (Ahead-of-Time) compiler that translates PHP source code to C++, then compiles it with GCC/Clang/MSVC into native binaries. It supports Linux (primary), macOS, and Windows.
TypePHP is an AOT (Ahead-of-Time) compiler that translates PHP source code to C++, then compiles it with GCC/Clang/MSVC into native binaries. It supports Linux (primary), macOS, and Windows.
**Prerequisites**: PHP 8.2+, GCC 9+ (C++17), CMake 3.24+. The `swoole/phpx` extension must be compiled (see README.md).
@ -31,7 +31,7 @@ Example: PHP permits `return $value;` inside `__construct()` and lets callers co
composer install
# Compile a PHP project to a native binary
php bin/compiler.php <path-to-project-or-file>
./tpc <path-to-project-or-file>
# Run all PHPUnit tests
./vendor/bin/phpunit

@ -13,7 +13,7 @@ if (PHP_OS_FAMILY !== 'Windows') {
}
echo "========================================\n";
echo "Swoole Compiler Windows 打包脚本\n";
echo "TypePHP Windows 打包脚本\n";
echo "========================================\n\n";
// ==================== 配置参数 ====================

@ -15,12 +15,12 @@ resource:
file-version: 0.1.0.1052
product-version: 0.1.0
company-name: "上海识沃网络科技有限公司"
file-description: "Swoole AOT Compiler"
internal-name: "swoole-compiler"
file-description: "TypePHP Compiler"
internal-name: "typephp"
legal-copyright: "Copyright (C) 2026 上海识沃网络科技有限公司"
legal-trademarks: "Swoole is a trademark of 上海识沃网络科技有限公司"
original-filename: "swoole_compiler.exe"
product-name: "Swoole Compiler"
original-filename: "tpc.exe"
product-name: "TypePHP"
comments: "PHP 原生编译器,可将 PHP 项目编译为 Windows/Linux/macOS 平台原生的可执行文件"
# Windows 应用程序清单文件(缺省不携带 manifest)

@ -1,6 +1,6 @@
<?php
/**
* This file is part of Swoole-Compiler(AOT).
* This file is part of TypePHP.
*
* @link https://www.swoole.com/
* @contact service@swoole.com

@ -1,6 +1,6 @@
<?php
/**
* This file is part of Swoole-Compiler(AOT).
* This file is part of TypePHP.
*
* @link https://www.swoole.com/
* @contact service@swoole.com

@ -1,6 +1,6 @@
<?php
/**
* This file is part of Swoole-Compiler(AOT).
* This file is part of TypePHP.
*
* @link https://www.swoole.com/
* @contact service@swoole.com
@ -6282,7 +6282,7 @@ class CompilerBase extends \PhpAot\Core\Translator implements PropertyAccessCont
protected function parseChainedExpr(NodeAbstract $node, string $op, bool $getValue = false): string
{
// AOT 编译器不允许操作未定义的变量,PHP 的 isset($var) 可能 $var 未定义
// TypePHP 编译器不允许操作未定义的变量,PHP 的 isset($var) 可能 $var 未定义
$this->checkVarMustExist($node, $this->parseIdentifier($node));
$fn = $this->getChainedFunc($op);
$expr = $node;

@ -1,6 +1,6 @@
<?php
/**
* This file is part of Swoole-Compiler(AOT).
* This file is part of TypePHP.
*
* @link https://www.swoole.com/
* @contact service@swoole.com

@ -1,6 +1,6 @@
<?php
/**
* This file is part of Swoole-Compiler(AOT).
* This file is part of TypePHP.
*
* @link https://www.swoole.com/
* @contact service@swoole.com

@ -1,6 +1,6 @@
<?php
/**
* This file is part of Swoole-Compiler(AOT).
* This file is part of TypePHP.
*
* @link https://www.swoole.com/
* @contact service@swoole.com

@ -1,6 +1,6 @@
<?php
/**
* This file is part of Swoole-Compiler(AOT).
* This file is part of TypePHP.
*
* @link https://www.swoole.com/
* @contact service@swoole.com

@ -1,6 +1,6 @@
<?php
/**
* This file is part of Swoole-Compiler(AOT).
* This file is part of TypePHP.
*
* @link https://www.swoole.com/
* @contact service@swoole.com

@ -1,6 +1,6 @@
<?php
/**
* This file is part of Swoole-Compiler(AOT).
* This file is part of TypePHP.
*
* @link https://www.swoole.com/
* @contact service@swoole.com

@ -1,6 +1,6 @@
<?php
/**
* This file is part of Swoole-Compiler(AOT).
* This file is part of TypePHP.
*
* @link https://www.swoole.com/
* @contact service@swoole.com

@ -1,6 +1,6 @@
<?php
/**
* This file is part of Swoole-Compiler(AOT).
* This file is part of TypePHP.
*
* @link https://www.swoole.com/
* @contact service@swoole.com

@ -1,6 +1,6 @@
<?php
/**
* This file is part of Swoole-Compiler(AOT).
* This file is part of TypePHP.
*
* @link https://www.swoole.com/
* @contact service@swoole.com
@ -39,7 +39,7 @@ use Symfony\Component\Yaml\Yaml;
class Translator extends Preprocessor
{
public const string VERSION = '0.3.0';
public const string APP_NAME = 'Swoole-Compiler (AOT)';
public const string APP_NAME = 'TypePHP';
protected string $targetName = 'app';
protected array $sourceDirs = [];
protected bool $verbose = false;

@ -1,6 +1,6 @@
<?php
/**
* This file is part of Swoole-Compiler(AOT).
* This file is part of TypePHP.
*
* @link https://www.swoole.com/
* @contact service@swoole.com

@ -7,7 +7,7 @@ function main(int $argc, array $argv): void
define("ROOT_PATH", getcwd());
}
// .prof 文件分析模式:php bin/compiler.php app.prof
// .prof 文件分析模式:./tpc app.prof
if ($argc >= 2 && str_ends_with($argv[1], '.prof')) {
profileAnalyze($argc, $argv);
return;
@ -58,7 +58,7 @@ function profileAnalyze(int $argc, array $argv): void
if (!file_exists($binary)) {
fwrite(STDERR, "Binary not found: {$binary} (expected from prof file name)\n");
fwrite(STDERR, "Usage: php bin/compiler.php <binary>.prof\n");
fwrite(STDERR, "Usage: ./tpc <binary>.prof\n");
exit(1);
}

@ -1,6 +1,6 @@
<?php
/**
* This file is part of Swoole-Compiler(AOT).
* This file is part of TypePHP.
*
* @link https://www.swoole.com/
* @contact service@swoole.com

@ -1,6 +1,6 @@
<?php
/**
* This file is part of Swoole-Compiler(AOT).
* This file is part of TypePHP.
*
* @link https://www.swoole.com/
* @contact service@swoole.com

Loading…
Cancel
Save