The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.

assertion(&assert) runs &assert. If the result is true, is continues. If it is false, it backtracks.

empty matches nothing, successfully.

concat($a, $b) first tries to match $a, then tries $b where $a left off.

alternate($a, $b) tries $a, and tries $b if $a fails.

quantify($p, $low, $high) tries to match $p at least $low times, and at most $high times. If $low is not given, it defaults to 0. If $high is not given, it defaults to infinity. So /a*/ can be written quantify(literal("a")).

quantify also takes a :minimal argument, which, if present, tells the combinator to succeed as soon as it has matched $low times, and backtrack by matching more.

optional($p) is pretty much the same as quantify($p,0,1), but it has its own combinator because it stores captures differently. Instead of creating another level of arrays in the captures, it simply doesn't put anything there if it didn't match.

optional also takes a :minimal argument, which does the same thing as it does above in quantify.

capture($p, :num($num), :name($name)) will capture whatever $p matched into $match.capture_num[$num] and $match.capture_name{$name}. $p will be given a fresh, empty $match.match to fill (this introduces a new scope). If no $num or $name is given, a new scope is introduced but the resulting object is discarded (used for eg. <?ws>).

mark($p, $name) simply executes $p, while setting up a backtracking mark named $name. The name is scoped to $p. That is, once the match succeeds beyond $p, the mark is no longer valid. This gives the impression of lexically scoped marks (but it may also limit the engine semantically, we shall see). See commit.

commit($name) will always succeed. When backtracked over, it skips to the mark (see above) named $name. It's not clear what these mean for non-backtracking engines.

subrule($code) executes $code, passing the match object as a parameter, and it should return a compiled rule (i.e. a Rule object, not a Parser object). This rule is then incorporated into the match. XXX it is not clear that this is the optimal interface for this combinator.