The cycle detection itself is necessary, but I found a behavioral difference from the standard (Section 7.2.8).
When a group body is nullable (e.g. A? in (A?){2,3}), the visited bitmap blocks re-entry to the skipped variable, so the END element never gets a chance to produce an exit state for count < min. The standard/Perl allows empty iterations to count toward min.
I plan to fix this by adding a compile-time flag on END elements that indicates the group body can iterate with empty matches. When the flag is set, nfa_advance_end() will generate the exit state even when count < min.
> nocfbot-0006: Allow A{0} quantifier
After reviewing the standard, I'd like to withdraw this patch.
Section 4.14.1 explicitly requires n > 0 for the {n} quantifier. While A{0} works correctly as an epsilon transition with the cycle detection in place, it violates the standard.
Since we aim for standard conformance, I think we should keep the n >= 1 restriction for {n}.