Is there anything else but perl that can parse perl hash notation? | [reply] |
| [reply] |
Note that perl is written in C, not Perl. So, it's C parsing Perl hash notation - not Perl. :-)
| [reply] |
As with many things in the Unix universe, the saying, "Nothing can parse Perl except perl" is case-sensitive. The saying means, "Nothing can parse the language of Perl except the executable called perl."
The Windows equivalent would be: "Nothing can parse Perl except PERL.EXE."
The saying is NOT trying to suggest that a Perl script can flawlessly parse Perl language snippets. That is a common misconception and misunderstanding. A parser written in Perl can do a lot, but any parser you're likely(*) to write in Perl will fail to parse all of the Perl language.
The wisdom in this koan is to realize that the Perl language is so crufty with special-cases and funky exceptions to its own grammars that it would be folly to try to parse any Perl script by writing a parser from scratch. Even the human brain can't always parse Perl in many cases. You'll get hung up on the many years of grammar evolution.
(*) Unless you're implementing Perl6, which is really just using Perl6 to plan Perl6.
-- [ e d @ h a l l e y . c c ]
| [reply] |