PHP Lexer and Parser Generator? [closed]

你离开我真会死。 提交于 2019-11-28 06:33:51
SteAp

I'd propose to give ANTLR a try. ANTLRWorks might be helpful.

I wrote an LL(1) parser generator myself in pure PHP, since I wasn't aware of other PHP-based solutions.

Robert Plummer

I've ported Jison, a Bison clone in javascript, to php. The results are a killer parser, able to handle very simple and very complex lexing/parsing. It is now part of Jison, but there are a few updates in my fork.

The files are here. See the readme in that page, you create a javascript and php parser at the same time that are capable of doing the same or different things.

It is stable, fast, easy and fun to use.

There's latest grammar file for PHP 7.4: https://github.com/php/php-src/blob/af12aa8124232b8fb6e96736e1232f6e0d2554e8/Zend/zend_language_parser.y

PHP using re2c parser generator, but as I know its syntax compatible with ANTLR.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!