in reply to Finite Automaton
This guy is missing out. I remember doing an assignment like this in my Theory of Computation class, for a Mealy Machine. What made it hard was that conditional statements were not allowed anywhere in the program. I spent a lot of skull sweat on that one. Once the light dawned on me, I understood the true meaning of a State Machine. It was wonderful. The result was less than 60 lines of C, but it was one of the most satisfying programs I have ever written.