evanw / fsm

Finite State Machine Designer
297 stars 145 forks source link

Using a simple notation for export and import #7

Closed omarzd closed 7 years ago

omarzd commented 7 years ago

I thought we can preserve the information of a FSM to import later by using a simple format like aut, explained here. The import would be trickier than the export, but not hard at all. For the export, I wrote the following function:

function saveAsAUT() {
  var autData = '';
    autData += 'des (0,'+ links.length +','+ nodes.length +')\n';
    for(var i = 0; i < links.length; i++) {
      autData += '('+ links[i].nodeA.text +','+ links[i].text +','+ links[i].nodeB.text +')\n';
    }
  output(autData);
}
omarzd commented 7 years ago

I just learned that the AUT format cannot describe final states. So I'll close this, but we might look at the DOT format which GraphViz uses. That would be useful.