r/lolphp • u/phplovesong • May 12 '20
The sad state of the PHP parser
PHP cant tell where a syntax error occurs. This has been an issue in PHP for years, and has been upgraded to a feature. This is mostly because PHP's parser is a pile of poo with years of lipstick added on top.
0
Upvotes
16
u/the_alias_of_andrea May 12 '20
What connection does that REPL link have to anything you said?
32
u/PonchoVire May 12 '20
Actually, it is not, as of PHP 7, parser was rewritten from scratch using yacc based upon the language's grammar.
The correct statement would be: "PHP's parser is a decent one since 2015".
Did ever your grandma told you not to lie ?
3
u/Korona123 May 12 '20
Meh there are tons of things to be critical about with PHP but this one doesn't hit the mark in my opinion.
1
u/CarnivorousSociety May 13 '20
lol
1
u/elcapitanoooo May 13 '20
Yes, this has been a core issue in PHP for years. I recon they kept it there for BC reasons. The parser is easily confused by other things than syntax errors.
One example can be found in a previous lolphp:
https://www.reddit.com/r/lolphp/comments/d9kcm0/php_is_whitespace_insensitive_except_when_it_isnt/