On Fri, Apr 03, 2009 at 03:05:22PM -0400, Tom Metro wrote: > The next section on formal language theory does define a bunch of > specific rules implemented by regular expressions, so in theory this > would be where Perl 6 deviates. Can anyone sum up the ways in which Perl > 6 breaks from the accepted definition of regular expressions?
It's been a few decades since I took Automata Theory in university, but IIRC the standard ivory tower regular expressions have grouping, alternation, and closure, or in re terms, () | and *. Much of perl's re forms can be created from those (e.g. x+ is the same as xx*). The original thing that was outside the official scope was backreferences (i.e. \1 to refer to something matched earlier in the same re). I'm sure that other things in the extended line noise re bestiary also cannot be reduced to convenience expressions of basic re's. However, the ivory tower definitions are useful mostly for analysing complexity. Sometimes you need a more powerful mechanism - and including such mechanisms into a tool based on re's is not a problem in a practical way, it just means that some of the theory no longer applies (so you can accomplish things that the theory says are impossible). As I recall, the standard textbook at the time was written by Hopcroft and Ullman - the title was something like "Formal Languages and Automata Theory". _______________________________________________ Boston-pm mailing list Boston-pm@mail.pm.org http://mail.pm.org/mailman/listinfo/boston-pm