Destate (Discrete Event System Toolkit and inTeractive Environment) is a tool to create and do operations with automata.
The following explains how install the Destate tool.
To install Destate you have to satisfy the following dependencies:
Destate works under Unix, Windows and Mac OS X (these two last are not tested yet, but probably can run without big problems) operating systems.
Get latest version at the GitHub repository.
To start the application you can execute this command:
$ python destate.pyw
If everything is correct, you'll see something like images in the screenshots section. You also may open some examples at share/sample directory.
To create the automaton you need use the command line interface (or, soon, load XML description file). Bellow we present a table with commands and their descriptions.
Command | Description |
---|---|
do |
Do operations with selected automaton. |
add |
Add states, events or transitions. |
del |
Delete states, events or transitions. |
init |
Set the initial state. |
mark |
Add a finalo state. |
unmark |
Remove a initial state. |
The commands add
and del
always are followed by a element token
(state, event or transition) and a element argument. Before
continue with the element arguments we need to define how can be defined a
state and a event. In table bellow is discriminated with regular
expression valid states and events.
Token | Regular expression |
---|---|
state |
[\w]+(,[\w])* |
event |
[\w]+ |
If you want to add two states called "A" and "b", an event called "x" and make a transition from "A" to "B" give "x" you must type:
add state A add state B add state C add event x add lambda A C add transition A x B
The commands init
, mark
and unmark
are followed by a state
token. To set "A" the initial state of the automaton and "B" an final state
you must type:
init A mark C
To remove final state flag from a state you can type unmark
instead
mark
command. And finally, to convert an NFA to a DFA you can just type:
do nfa2dfa
Destate has the capability of read and write XML descriptions of automata. Below an example of a XML automaton description.
<?xml version="1.0" encoding="utf-8"?> <automaton start="A" name="Example"> <states> <state name="A"/> <state name="B" option="final"/> <state name="C"/> </states> <events> <event name="x"/> <event name="y"/> <event name="z"/> </events> <lambdas> <lambda from="A" to="B"/> <lambda from="C" to="B"/> </lambdas> <transitions> <transition from="A" when="x" to="A"/> <transition from="B" when="x" to="A"/> <transition from="C" when="x" to="A"/> <transition from="A" when="y" to="B"/> <transition from="B" when="y" to="B"/> <transition from="C" when="y" to="B"/> <transition from="A" when="z" to="C"/> <transition from="B" when="z" to="C"/> <transition from="C" when="z" to="C"/> </transitions> <comment>Destate XML example.</comment> </automaton>
View source file index.t2t.