tags:

views:

931

answers:

2

Is there a tool which generates the state space by seeing the code. i.e., if I give a class definition, it should generate the state machine.

EDIT: State machine I mean is just the graphical representation of the classes and state changes.

+1  A: 

I'm afraid you'll have to be more specific.

The state space of a class is the Cartesian product of the state space of each component, and it doesn't take a particularly complicated class to have more possible states than there are protons in the Universe. With a few exceptions, C++ code is not well suited to analysis with state space.

State machines are usually associated with regular expressions. Do you want a tool that does something with a regular expression?

If so, what? Languages that accept regular expressions do something to convert them to a form of state space representation, leaving it in some sort of internal form. Do you want it in the form of a readable diagram, as the tag implies?

David Thornley
A: 

Many classes have infinite numbers of states, so creating the statemachine would be infeasible... For example, there is no DFA for palindrome, so any class which accepts palindromes won't have a usable state diagram...

Brian Postow