Duane Bronson wrote:
He also mentioned that he has not come up with a good name for the new
pattern matching syntax that is meant to replace perl5's regex. I
applaud this renaming as "regex" (regular expression) is not very
regular since it varies so much from grep/vim/sed/etc.
Right, he aluded to the Perl 6 implementation technically not fitting
the formal definition of regular expression, which made me wonder what
the formal definition was. Wikipedia says:
http://en.wikipedia.org/wiki/Regular_expression
In the 1950s, mathematician Stephen Cole Kleene described these models
using his mathematical notation called regular sets. ... Ken Thompson
built Kleene's notation into the editor QED as a means to match
patterns in text files. He later added this capability to the Unix
editor ed, which eventually led to the popular search tool grep's use
of regular expressions ("grep" is a word derived from the command for
regular expression searching in the ed editor: g/re/p where re stands
for regular expression[1]). Since that time, many variations of
Thompson's original adaptation of regular expressions have been widely
used in Unix and Unix-like utilities including expr, AWK, Emacs, vi,
and lex.
So far that seems pretty vague and broad, with "regular" coming from the
analogy to "regular sets," but not necessarily imposing any strict
meaning on the language.
It goes on...
Part of the effort in the design of Perl 6 is to improve Perl's
regular expression integration, and to increase their scope and
capabilities to allow the definition of parsing expression
grammars.[3] The result is a mini-language called Perl 6 rules, which
are used to define Perl 6 grammar as well as provide a tool to
programmers in the language. These rules maintain existing features of
Perl 5.x regular expressions, but also allow BNF-style definition of a
recursive descent parser via sub-rules.
The author here doesn't suggest that Perl 6's implementation goes beyond
the scope of what is known as a regular expression.
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?
-Tom
--
Tom Metro
Venture Logic, Newton, MA, USA
"Enterprise solutions through open source."
Professional Profile: http://tmetro.venturelogic.com/
_______________________________________________
Boston-pm mailing list
[email protected]
http://mail.pm.org/mailman/listinfo/boston-pm