Implement Finite State Machine semantics for code generation.

@since Ptolemy II 8.2