A regular expression evaluator from scratch