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