๐ Hi there! I'm Justin Woodring!
I built DFAify as a hobby project to allow users to model and inspect the behaviour of basic DFAs. DFAify is a diagramming and graphical analysis tool supporting playback and stepping logic for DFAs.
If you really love DFAify consider supporting me! ๐ต paypal.me/jwoodrg
If you just want to use DFAify, I recommend taking a look at the releases.
But if you're curious here's how you build from the source:
- Install JDK 17, I recommend Adoptium's builds.
- Clone this repo.
- Run
./gradlew run
on Linux and Mac or.\gradlew.bat run
on Windows - Done! ๐ฅณ
DFAs are expressed in a very simple xml format. Here's a sample:
<dfa>
<state name="EVEN A" ref="even" entry="true" final="true">
<conn to="odd" takes="a"/>
<conn to="even" takes="b"/>
</state>
<state name="ODD A" ref="odd" entry="false" final="false">
<conn to="even" takes="a"/>
<conn to="odd" takes="b"/>
</state>
</dfa>
Rules:
- A DFA XML documents begins with a
<dfa>
and ends with a</dfa>
- A DFA must have at least one
<state>
. - Each
<state>
must be an child of the dfa root element. - Each
<state>
has aname
attribute which will be displayed when they are rendered. - Each
<state>
has aref
attribute which is how you will reference other states in their connections or<conn>
tags.ref
attributes must hold unique values.
- Each
<state>
has aentry
attribute which is boolean flag indicating whether that state is the DFA's entry point.- There must one and only one
entry
attribute flagged astrue
- There must one and only one
- Each
<state>
has afinal
attribute declaring whether that state is a final state or not.- You can any number of final states including zero.
- Each
<conn>
tag must be a child of a state element. - Each
<conn>
has ato
attribute which takes the value of aref
attribute on a<state>
- Each
<conn>
has atakes
attribute takes a character which represents the transition character to another<state>
- Each
<conn>
cannot have another sibling<conn>
which has the sametakes
attribute.
- Each
- All attributes are not optional.
Save this file with an .xml
extension. And open it up in DFAify.