Slashdot Mirror


Perl 6 Grammars and Regular Expressions

An anonymous reader writes "Perl 6 is finally coming within reach. This article gives you a tour of the grammars and regular expressions of the Perl 6 language, comparing them with the currently available Parse::RecDescent module for Perl 5. Find out what will be new with Perl 6 regular expressions and how to make use of the new, powerful incarnation of the Perl scripting language."

3 of 202 comments (clear)

  1. Re:Big problem by Speare · · Score: 5, Informative
    Um, ALL PERL CODE IS TREATED AS PERL5 CODE unless you use a specific Perl 6 keyword in your script. Perl 6 interpreters will not require you modify your scripts AT ALL to use Perl 5 scripts.

    Therefore, it's just Perl 6 scripts which want to use Perl 5 regular expression syntax, which would want to use the :p5 modifier.

    Don't get your knickers in a bunch.

    --
    [ .sig file not found ]
  2. Re:Grammar by Mr.+Muskrat · · Score: 5, Informative

    Perl never was an acronym. It's a backronym.

    Perl is the language and perl is the interpreter. Remember, "only perl can parse Perl" and it's easy to remember.

  3. Re:Big problem by Zaak · · Score: 5, Informative
    Meaning that it is not backward compatible without modifying your source code.

    Thus spake Larry Wall in Apocalypse 5:
    ...we took several large steps in Perl 5 to enhance regex capabilities. We took one large step forwards with the /x option, which allowed whitespace between regex tokens. But we also took several large steps sideways with the (?...) extension syntax. I call them steps sideways, but they were simultaneously steps forward in terms of functionality and steps backwards in terms of readability. At the time, I rationalized it all in the name of backward compatibility, and perhaps that approach was correct for that time and place. It's not correct now, since the Perl 6 approach is to break everything that needs breaking all at once.

    And unfortunately, there's a lot of regex culture that needs breaking.

    And from Apocalypse 1:
    It would be rather bad to suddenly give working code a brand new set of semantics. The answer, I believe, is that it has to be impossible by definition to accidentally feed Perl 5 code to Perl 6. That is, Perl 6 must assume it is being fed Perl 5 code until it knows otherwise.

    In other words, it is backwards compatible, it isn't backwards compatible, and when you install Perl 6, you are installing both.

    TTFN