# php-grammar: source-backed EBNF grammar for PHP

- Thread: https://externals.io/message/132485
- Original archive: https://news-web.php.net/php.internals/132485
- Started by Alwyn Bester on 2026-09-12T17:50:27+00:00
- Messages: 1
- Reply by email to internals@lists.php.net
- More for agents: search with https://externals.io/search.md?q={query} · RFCs at https://externals.io/rfc.md · JSON API at https://externals.io/api · documentation at https://externals.io/llms.txt

---

## #132485 — Alwyn Bester — 2026-09-12T17:50:27+00:00

URL: https://externals.io/message/132485#132485

Hi all,

I’d like to make the PHP development community aware of a project I’ve 
been working on called *php-grammar*.

The project provides versioned, source-backed EBNF grammar definitions 
for PHP language syntax, together with matching human-readable 
documentation.

The current PHP 8.5 grammar has been developed and audited against the 
PHP parser source, with the goal of representing the language syntax as 
accurately and completely as possible while keeping the grammar useful 
to tooling authors and other consumers.

The project is independent and is not presented as an official PHP 
specification. My main reason for posting here is to invite technical 
review from people familiar with the PHP parser and language implementation.

In particular, I’d be very interested in feedback on:

  * places where the EBNF does not accurately represent parser behaviour;
  * syntax that cannot reasonably be represented in pure EBNF without
    additional semantic restrictions;
  * contextual or parser-specific constraints that should be documented
    more clearly; and
  * whether the overall approach could be useful to parser, IDE,
    documentation, static-analysis, or other tooling projects.

Website:
https://zoclee.com/php-grammar <https://zoclee.com/php-grammar>

GitHub:
https://github.com/Zoclee/php-grammar

Any corrections, criticism, or suggestions would be very welcome.

-- 
{Zoclee}

Kind regards,

Alwyn Bester
Founder and CEO
