I do not know the supported parser generators written in PHP. But there are parser generators written in other languages with PHP as the target language. The one I personally used was kmyacc. There is PHP and a Windows compatible plug . The grammar for it is written in yacc format and can be compiled in PHP using this command:
kmyacc -l -m %PARSER_PROTOTYPE_FILE% -p %NAME% %GRAMMAR_FILE%
Kmyacc already has a prototype procedural parser prototype file for PHP, but I personally use a modified version of the prototype based on OOP .
As an example: This grammar is compiled into this parser . (Note that the grammar is huge, so the generated parser has two and a half thousand lines. The "normal" grammar will obviously be much smaller.)
NikiC
source share