Re:Perl code that is syntactically correct only on Fridays
by bmn__ on Wednesday February 16, 2022 @11:00AM
(#30361684)
It can be externally parsed with ambiguities. The article is written by someone who authored such a parsing toolkit about three years later. Despite what you may have learnt, an ambiguous parse tree is still a useful thing to have, we can build tools taking it into account, also most existing tools can be modified in a straightforward fashion to make use of the extra nodes.
The real Perl parser disambiguates with heuristics and run-time hints.
There exists an unambiguous subset of Perl syntax that is expressible with a BNF grammar, and such is amenable to all parsers. http://p3rl.org/standard#DESCRIPTION
Re:Perl code that is syntactically correct only on Fridays
by lloeki on Wednesday February 16, 2022 @11:56AM
(#30362393)
Yeah, I always found the linked post to not be all that serious about it anyway, just a funny, satisfying hacker thing.
Re:Perl code that is syntactically correct only on Fridays
by RandalSchwartz on Wednesday February 16, 2022 @03:57PM
(#30365574)
It has been said that "the Perl compiler is based on yacc, lex, smoke, and mirrors."
https://www.perlmonks.org/index.pl?node_id=663393