added solution for keeping track of number of captures
added an error when the start of a repetition range was greater than the end, and made compile return a Prog