Hacker News new | ask | show | jobs
by lloeki 1582 days ago
It is formally proven that Perl can't be parsed!

https://www.perlmonks.org/index.pl?node_id=663393

2 comments

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

Yeah, I always found the linked post to not be all that serious about it anyway, just a funny, satisfying hacker thing.
It has been said that "the Perl compiler is based on yacc, lex, smoke, and mirrors."