Packages

PHP 8 interpreter in Erlang/OTP for the BEAM

Current section

Files

Jump to
pinchpi README.md
Raw

README.md

<p align="center">
  <img src="assets/logo.png" alt="PinchPi Logo" width="160">
</p>

# 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, and `Throwable` error 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 + `yecc` Parser:** A dedicated stateful binary lexer (handling HTML/PHP mode switching, heredocs, nowdocs, and string interpolation) paired with a clean `yecc` grammar.
- **OTP 28+ Native Core:** Zero external runtime dependencies in the core, leveraging OTP 28+ primitives including the native `json` module.

---

## Requirements

- **Erlang/OTP 28** or later (tested on OTP 29)
- **`rebar3`**

---

## Build & Test

```sh
rebar3 compile
rebar3 eunit
```

Run the full quality gate (`erlfmt`, `elvis`, `xref`, `prisma`, `eunit`, `cover`, `hex outdated`):

```sh
rebar3 check
```

Format code with `erlfmt`:

```sh
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](LICENSE) for details.