Reading file and automata