Raku rules

Since Perl's pattern-matching constructs have exceeded the capabilities of formal regular expressions for some time, Raku documentation refers to them exclusively as regexes, distancing the term from the formal definition.

Raku provides a superset of Perl 5 features with respect to regexes, folding them into a larger framework called rules, which provide the capabilities of a parsing expression grammar, as well as acting as a closure with respect to their lexical scope.

In Apocalypse 5, a document outlining the preliminary design decisions for Raku pattern matching, Larry Wall enumerated 20 problems with the "current regex culture".

[2] Between late 2004 and mid-2005, a compiler for Raku style rules was developed for the Parrot virtual machine called Parrot Grammar Engine (PGE), which was later renamed to the more generic Parser Grammar Engine.

However, because before can encapsulate arbitrary rules, it can be used to express lookahead as a syntactic predicate for a grammar.

There is no way for the rule engine to know what conditions the assertion may match, so no optimization of this process can be made.

In many languages, regular expressions are entered as strings, which are then passed to library routines that parse and compile them into an internal state.

This simplified many aspects of regular expression usage, though it added a great deal of complexity to the scanner.