The program in C++ using object-oriented style could look like this: To minimize changes not directly related to the subject of the article, the input/output getchar and putchar functions from the standard library of C are being used.Its main advantages over code using state-transition tables are that virtual function calls are often more efficient than table lookups, that state-transition criteria are more explicit than in tabular format, and that it is easier to add actions accompanying state transitions.The combination of possible states can generate a wide variety of events, thus defining a more complex production cycle.There are commonly parallel branches running together and alternatives selected according to different events, schematically represented below: Automata-based programming is widely used in lexical and syntactic analyses.For instance, UML-based software architecture development uses state diagrams to specify the behaviour of the program.Thinking in terms of automata (steps and states) can also be used to describe semantics of some programming languages.Alexander Ollongren in his book[2] explains the so-called Vienna method of programming languages semantics description which is fully based on formal automata.Automata-based techniques were used widely in the domains where there are algorithms based on automata theory, such as formal language analyses.[3] One of the earliest mentions of automata-based programming as a general technique is found in the paper by Peter Naur, 1963.Such methods must not call each other nor themselves, neither directly nor indirectly, otherwise the object can not be considered to be implemented in an automata-based manner.