You don't specify what you're doing, but you might want to know there is a tool called Ragel that specializes in FSMs. It generates code for a slew of languages, and when I looked a few years ago, it wasn't too hard to port the machines to other languages.