Overhaul automata.py and related things
Change automata related tests
Fix codegen duplicating backslashes
Make nim example fully functional