construct a regular expression engine used the algorithm in the Compilers(second edition)