Use macro for magic number indicating an infinite number of repeats.
Use explicit backtracking stack rather than recursion.

Lets us safely detect overflow instead of crashing.
Check for infinite loops matching the empty string at parse time.