Formal Languages and their Relation to Automata