A "rule" function gets as argument a list:

0 - a string to match 1 - an optional "continuation" 2 - an optional "flags" hashref 'capture'=>1 means 'return whatever matches'

it returns (or "yields"):

undef - match failed

or a hash containing:

state - a "continuation" or undef
bool - an "assertion" (true/false)
match - the "match" tree or undef
tail - the string tail or undef
capture - the tree of captured things
abort - the match was stopped by a { return } or a fail(),
       and it should not backtrack or whatever

Continuations are used for backtracking.

A "ruleop" function gets some arguments and returns a "rule".