in reply to Re: Only perl parses perl hash notation?
in thread Only perl parses perl hash notation?

Is there anything else but perl that can parse perl hash notation?
  • Comment on Re^2: Only perl parses perl hash notation?

Replies are listed 'Best First'.
Re^3: Only perl parses perl hash notation?
by gothic_mallard (Pilgrim) on Oct 05, 2004 at 10:15 UTC

    Probably not off the shelf, but I'm sure you could write a little app to parse it using any language that takes your fancy - it's only plain text when it comes down to it after all.

    --- Jay

    All code is untested unless otherwise stated.

Re^3: Only perl parses perl hash notation?
by Anonymous Monk on Oct 05, 2004 at 12:03 UTC
    Note that perl is written in C, not Perl. So, it's C parsing Perl hash notation - not Perl. :-)
      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 ]

        The Windows equivalent would be: "Nothing can parse Perl except PERL.EXE."

        Funnily enough, my Perl executable is named 'perl.exe'.

        The nice thing is though--just as in english where 'The', 'the', 'THE', 'tHe' etc. all have the same meaning, though some are more acceptable than others in some circumstances--I can type 'Perl', 'perl', 'PERL', the classic 'pERL', or any other combination and they all find my executable. Neat huh.

        I guess you could set up 15 alias' or symlinks :).


        Examine what is said, not who speaks.
        "Efficiency is intelligent laziness." -David Dunham
        "Think for yourself!" - Abigail
        "Memory, processor, disk in that order on the hardware side. Algorithm, algorithm, algorithm on the code side." - tachyon
        <Wassercats><Joke>

        So I should abandon my Perl 4 interpreter project that is to be completely written in Perl 5 then? Many people want Perl 4 these days and only Perl 5 comes installed on systems so this seemed like a good way to get them want they wanted. If there are any Perl 5 modules for parsing Perl 4 (or Perl 3) let me know and maybe we can fix this situation.

        </Wassercats></Joke>