Implement Finite State Machine semantics for code generation.

@since Ptolemy II 5.1