php-grammar: source-backed EBNF grammar for PHP

From: Date: Sat, 12 Sep 2026 17:50:27 +0000
Subject: php-grammar: source-backed EBNF grammar for PHP
Groups: php.internals 
Request: Send a blank email to internals+get-132485@lists.php.net to get a copy of this message
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

« previous php.internals (#132485) next »