PinchPi
PinchPi is a PHP 8 interpreter written in pure Erlang/OTP for the BEAM virtual machine.
It is the clean-slate successor to ephp, redesigned from the ground up for Erlang/OTP 28+ and seamless Elixir interoperability.
Key Design Goals
- PHP 8 Target: Built for modern PHP 8 syntax and semantics (typed properties, union/intersection types,
match, nullsafe?->, named arguments, arrow functions, attributes#[...], enums, andThrowableerror hierarchy). - Elixir-Friendly Structs: Internal AST nodes and runtime values use Erlang maps with
'__struct__'keys instead of legacy#record{}tuples, making them first-class structs when inspected or pattern-matched from Elixir. - Stateful Lexer +
yeccParser: A dedicated stateful binary lexer (handling HTML/PHP mode switching, heredocs, nowdocs, and string interpolation) paired with a cleanyeccgrammar. - OTP 28+ Native Core: Zero external runtime dependencies in the core, leveraging OTP 28+ primitives including the native
jsonmodule.
Requirements
- Erlang/OTP 28 or later (tested on OTP 29)
rebar3
Build & Test
rebar3 compile
rebar3 eunit
Run the full quality gate (erlfmt, elvis, xref, prisma, eunit, cover, hex outdated):
rebar3 check
Format code with erlfmt:
rebar3 fmt
Status
PinchPi is currently in active early development (project bootstrap and architecture phase).
The legacy ephp project remains available for PHP 5.x compatibility until PinchPi reaches feature parity.
License
MIT License — see LICENSE for details.