gakowalski/alternative-interpreters

GitHub: gakowalski/alternative-interpreters

这是一个收集PHP和JavaScript替代解释器、编译器及相关工具的资源列表,旨在为技术探索和实现优化提供参考。

Stars: 92 | Forks: 5

# 替代解释器 ## JavaScript 参见 [javascript.md](javascript.md) - 开发中。 ## SQL 参见 [sql.md](sql.md) - 开发中。 ## PHP ### 替代解释器和编译器 * [phprs](https://github.com/yingkitw/phprs) - 一个用 Rust 编写的内存安全的 PHP 解释器和工具链。 * [php-wasm](https://github.com/seanmorris/php-wasm) - 直接在浏览器中运行 PHP。包含实时演示。 * [ePHP](https://github.com/bragful/ephp) - 纯 Erlang 100% 实现的 PHP 解释器 (需要 Erlang/OTP 19+),参见 [兼容性表格](https://github.com/bragful/ephp/blob/master/doc/COMPATIBILITY.md)。 * [graalphp](https://github.com/abertschi/graalphp) - 一个实验性的、基于 [GraalVM](https://www.graalvm.org/22.2/docs/introduction/) 构建的、针对 PHP 7.4+ 的即时 (JIT) 编译器和运行时(参见一些 [基准测试](https://github.com/abertschi/graalphp/blob/master/results.md))。 * [Goro](https://github.com/MagicalTux/goro) - 用纯 [Go](https://go.dev/) 编写的 PHP 7.2 的不完整实现,支持 [goroutines](https://golangbot.com/goroutines/),通过允许在运行中的 PHP 脚本之间共享已编译或活跃的对象(类、对象等)来更好地缓存已编译的代码。 * [HippyVM](https://github.com/hippyvm/hippyvm) - 使用 RPython/PyPy 技术的 PHP 语言实现。 * [JPHP](https://github.com/jphp-group/jphp) - 将 PHP 7.1+ 源代码编译为可在 Java VM 上执行的 JVM 字节码;增加了在 PHP 中使用 Java 库、类 Java 的多线程、套接字、创建 GUI Android 和桌面应用 (JavaFX 或 SWT)、类和函数的热重载等功能;提供名为 [DevelNext IDE](https://github.com/jphp-group/develnext-ide) 的专用 IDE。 * [KPHP](https://vkcom.github.io/kphp/) - 将 PHP 的一个有限子集编译为比 PHP 运行更快的原生二进制文件。 * [PeachPie](https://www.peachpie.io/) - 一个基于 [Microsoft Roslyn](https://github.com/dotnet/roslyn) 编译器平台并借鉴 [Phalanger](https://github.com/DEVSENSE/Phalanger) 项目 (针对 .NET/Mono 的 PHP 5.4 编译器) 的现代 PHP 编译器;它允许 PHP 在 .NET 框架内执行,从而为 PHP 开发者打开了通向 .NET 世界的大门,反之亦然。[7] * [php-interpreter](https://github.com/tharzen/php-interpreter) - 一个用 TypeScript 编写的 PHP 解释器,支持 PHP 7。 * [php.js](http://phpjs.hertzen.com/) - 读取 PHP 代码并将其转换为 JavaScript 代码,然后运行。 * [PHP Emulator](https://github.com/abiusx/php-emul) - 模拟 PHP 5.4;用于高级调试。 * [PH7](https://ph7.symisc.net/) - PHP 5 的嵌入式实现,具有许多 PHP 7+ 和类似 C++ 的改进,参见其 [独特功能](https://ph7.symisc.net/features.html)。 * [pipp](https://github.com/RemiWoler/pipp) - 在 [Parrot 虚拟机](https://github.com/parrot/parrot) 上运行的 PHP 语言实现,是 [MoarVM](https://github.com/MoarVM/MoarVM) 的前身。 * [PolarPHP](https://github.com/polarphp/polarphp) - 支持异步编程、多线程和协程的 PHP 7 编译器。 * [pyhp](https://github.com/juokaz/pyhp) - 使用 RPython 技术实现的 PHP 语言的不完整版本 (完整实现请参见:HippyVM)。 * [pyhp.js](https://github.com/juokaz/pyhp.js) - 使用 emscripten 将 PyHP 解释器翻译成 JavaScript,生成的 javascript 文件是 asm.js 格式,可以在任何浏览器中加载或使用 Node.js 运行。 * [Quercus](https://www.caucho.com/resin-3.1/doc/quercus.xtp) - PHP 语言的 Java 实现。 * [PHPPHP](https://github.com/ircmaxell/PHPPHP) - 用 PHP 编写的 PHP 解释器,性能低下,是速度更快得多的 Recki Compiler Toolkit for PHP 的前身。 * [Recki Compiler Toolkit for PHP](https://github.com/google/recki-ct) - 引用自 [1]:"一个完全用 PHP 编写的编译器,仅针对 PHP 规范的一个子集。它故意限制自己使用一个更静态的子集以提高速度。这意味着它不支持引用、可变变量和全局变量等特性。Recki-CT 将 PHP 编译为机器代码,但与使用即时编译来编译 PHP 的 HHVM 和 HippyVM 不同,它使用提前编译,缓存一个可以在运行时编译的中间表示。因此,可以应用更积极的优化并生成更高效的代码。基于简单的基准测试,Recki-CT 证明速度极快。" * [php-compiler](https://github.com/ircmaxell/php-compiler) - PHP 编译器,PHPPHP 和 Recki Compiler Toolkit for PHP 的后继者。 * [Uniter](https://phptojs.com/) - 在浏览器或 Node.js 中的客户端 PHP。 在学术论文中引用但未在线找到: * P8 - 一个用 Java 实现的 PHP 5,支持生成 Java 字节码,运行在 IBM J9 VM 1.5.0 上,在 [4] 中引用。 * P9 - 一个基于即时编译器的 PHP 引擎,基于 IBM J9 VM 1.5.0,在 [4] 中引用。 一些旧资料:https://stackoverflow.com/a/1408499/925196 ### 转译器 * [Blueberry](https://github.com/gosukiwi/Blueberry) - 一种语法简洁的脚本语言,灵感来自 Ruby、CoffeeScript 和 Python,可编译为 PHP。 * [Fructose](https://github.com/haileys/Fructose) - 一种类似 Ruby 的语言,可编译为 PHP。 * [Haxe](https://haxe.org/) - 一种高级严格类型的编程语言,具有快速优化的交叉编译器,也可编译为 PHP。 * [lua2php](https://gitlab.com/the-language/lua2php) - Lua 到 PHP 的转译器。 * [mammouth](https://github.com/btwael/mammouth) - 一种可编译为 PHP 的小型语言,灵感来自 CoffeeScript (例如 "一切都是表达式");编译器本身是用 Dart 编写的。 * [Phabel](https://github.com/phabelio/phabel) - 允许在项目和库中原生使用 PHP 8+ 的特性,特别是语法,同时允许维护者发布针对更低版本 PHP 的版本。 * [Pharen](https://github.com/scriptor/pharen) - 将一种受 Lisp 启发的语言编译为 PHP。 * [Phel](https://phel-lang.org/) - Lisp 的一种方言,可编译为 PHP。 * [Pratphall](http://cretz.github.io/pratphall/) - 一种可选类型的语言,可编译为可读的 PHP。 * [Salty](https://github.com/egonschiele/salty) - 一种可编译为 PHP、JavaScript 和 JSX 的语言;受 Haskell 启发。 * [Snowscript](https://github.com/runekaagaard/snowscript) - 一种可编译为 PHP 的语言;其语法受 Python、Lua、CoffeeScript、Go 和 Scala 启发,力求简洁、干净、易读易写。 * [THT](https://tht.dev/) - 对 PHP 的一次简洁重新设计,使其更安全、更易用;参见 [THT 与 PHP 的对比](https://tht.dev/about/how-tht-compares-to-php)。 * [tré](https://github.com/SvenMichaelKlose/tre) - 将 Lisp 转译为 JavaScript 和 PHP7+;运行在 Steel Bank Common Lisp (sbcl) 之上。 * [XP Compiler](https://github.com/xp-framework/compiler) - 在 Hack 语言、PHP 8.2、8.1、8.0、PHP 7.4、PHP 7.3、PHP 7.2、PHP 7.1 和 PHP 7.0 之间进行转换。 还有并非针对完整编程语言的转译器: * [Swagger Editor](https://editor.swagger.io/) - 可以从 OpenAPI JSON 描述生成 PHP 客户端代码。 * [Twig](https://twig.symfony.com/) - 一种可编译为 PHP 的模板引擎和语言; ### 预处理器 * [Pre](https://github.com/preprocess) - 将新语法编译为可在新旧版本 PHP 中工作;该项目的原始网站已关闭,但其代码可在此 [GitHub 仓库](https://github.com/preprocess/preprocess.io) 中找到。尽管如此,最好还是查看所有可供用户 ["Pre."](https://github.com/preprocess) 使用的不同仓库,因为它们似乎是基于一些共享库或框架构建的不同预处理器(参见 [依赖于 pre/plugin 的软件包列表](https://packagist.org/packages/pre/plugin/dependents?order_by=downloads))。 ### 进程管理器 * [PHP-FPM](https://www.php.net/manual/en/install.fpm.php) - 主要的 PHP FastCGI 实现,包含对高负载网站有用的功能。 * [PHP-PM](https://github.com/php-pm/php-pm) - 一个用于使用请求-响应框架(如 Symfony 的 HTTPKernel)的 PHP 应用的进程管理器、超级充电器和负载均衡器;与 PHP-FPM、Symfony 应用相比,性能提升高达 15 倍。 * [FrankenPHP](https://frankenphp.dev/) - 构建在 Caddy Web 服务器之上的 PHP 应用服务器。 * [RoadRunner](https://roadrunner.dev/) - 用 Golang 编写的高性能 PHP 应用服务器、负载均衡器和进程管理器。 * Swoole * OpenSwoole * Laravel Octane ### 替代 PHP 虚拟机 * [HHVM](https://hhvm.com/) - 一个开源虚拟机,设计用于执行用 [Hack](https://hacklang.org/) 编写的程序(最初是 PHP 的超集)。 * [Tagua VM](https://github.com/tagua-vm/tagua-vm) - 一个实验性的 PHP 虚拟机,通过使用 Rust 语言和 LLVM 编译器基础设施消除大量类别的漏洞来保证安全性和质量。 ### 其他 * [AerScript](https://github.com/sc0ttj/AerScript) - 基于 PH7(替代 PHP 解释器)的通用、面向对象的脚本编程语言。 ### 源自 PHP 的语言 * [Hack](https://hacklang.org/) - 一种类似 PHP 的新语言,具有渐进类型、泛型和新容器类型(向量、映射、集合、对),在 HipHop 虚拟机 (HHVM) 上执行 [2][6]。 * [PXP](https://github.com/pxp-lang/pxp) - PHP 编程语言的超集,深受 TypeScript 项目目标的启发,旨在通过转译来改进和增强 PHP;拥有自己的语言服务器,可在编程编辑器和 IDE 中使用。 * [Plus-1](https://github.com/nunomaduro/plus-1) - 被描述为 "PHP 的超集" 和 "向 PHP 添加特性的运行时编译器",由 Laravel 社区最杰出的成员之一创建,遗憾的是文档似乎已丢失(原在 https://php-plus.com/ 但 Internet Archive 在尝试检索时返回错误)。 ### 研究论文 #### 参考文献 * [1] KHAN, Sher Ali; MAFFEIS, Sergio. A Comparative Study of PHP Dialects. 2015. * [2] ADAMS, Keith, et al. The hiphop virtual machine. In: Proceedings of the 2014 ACM International Conference on Object Oriented Programming Systems Languages & Applications. 2014. p. 777-790. * [3] OTTONI, Guilherme. HHVM JIT: A Profile-guided, Region-based Compiler for PHP and Hack. In: Proceedings of the 39th ACM SIGPLAN Conference on Programming Language Design and Implementation. 2018. p. 151-165. * [4] TATSUBORI, Michiaki, et al. Evaluation of a just-in-time compiler retrofitted for PHP. ACM Sigplan Notices, 2010, 45.7: 121-132. * [5] BENDA, Jan; MATOUSEK, Tomas; PROSEK, Ladislav. Phalanger: Compiling and running PHP applications on the Microsoft .NET platform. .NET Technologies 2006, 2006. * [6] ZHAO, Haiping, et al. The HipHop compiler for PHP. ACM SIGPLAN Notices, 2012, 47.10: 575-586. * [7] Robert Husák, Jakub Míšek, Filip Zavoral, Jan Kofroň. PeachPie: Mature PHP to CLI compiler, Journal of Computer Languages, Volume 73, 2022, 101152, ISSN 2590-1184, https://doi.org/10.1016/j.cola.2022.101152.
标签:CMS安全, DNS解析, Erlang, Go, GraalVM, GUI应用, JavaScript, JIT编译, JS文件枚举, JVM, OpenVAS, PHP, RPython, Ruby工具, Rust, SQL, WebAssembly, 内存安全, 原生编译, 可视化界面, 开源项目, 性能优化, 数据可视化, 日志审计, 替代实现, 检测绕过, 浏览器兼容, 热重载, 系统审计, 编程语言实现, 编译器, 网络流量审计, 解释器