Programming Using Automata and Transducers