Theory of Automata and Formal Languages