Vinay
Vinay

Reputation: 4783

State Diagram Generator

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.

Upvotes: 3

Views: 1981

Answers (2)

Brian Postow
Brian Postow

Reputation: 12167

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...

Upvotes: 0

David Thornley
David Thornley

Reputation: 57036

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?

Upvotes: 1

Related Questions