dfa emulation, finished all algorithmic work