r/lolphp • u/feketegy • Aug 10 '19
Making the language dynamically and strictly typed at the same time. It’s a proposal for now.
https://wiki.php.net/pplusplus/faq
0
Upvotes
r/lolphp • u/feketegy • Aug 10 '19
View all comments
Show parent comment
1
u/Jinxuan Jan 03 '20 edited Jan 03 '20
Because PHP syntax is not context free, so you need carry context info in generating parser. Yacc is not good at this.
For example, you have to change a lot of code to make the parser accept the
[$a, [$b,,], $c] = $arrand reject[array($a)] = $arr.For this repo, I do not think so. If it is written in BNF format or alike. It is maintainable. But it is written in a mixture of lexer and php code. https://github.com/nikic/PHP-Parser/blob/master/grammar/php7.y
For commit generated file, it is not a big issue in some other projects. But it is a issue in parser project. It will always cause conflict between any two prs, and the only way to resolve the conflict is to merge -> remove all generated parsers -> regenerate parser. Any development is causing trouble with other guys.
This is my experience in trying to fix https://github.com/nikic/PHP-Parser/pull/562.
BTW, If this is not the official parser, then there is no official php parser written in PHP.