Automata via Macros (Lisp) [pdf]
cs.brown.edu
cs.brown.edu
There was a nice discussion of it on LtU: http://lambda-the-ultimate.org/node/569
The discussion focussed on whether it was good to do this internally using macros, rather than use an external code-generating tool.