add dfa implementation and the related tests