Zakrok09 / ts-automata

TS-AUtomata is an automata simulation utility package for FSMs, PDAs, TMs written for/in JS/TS.
MIT License
29 stars 0 forks source link

FEAT: DFA Parsing #13

Open Zakrok09 opened 5 months ago

Zakrok09 commented 5 months ago

Problem:

As suggested by @vesk4000, there could be a DFA / Automata parser from some string that represents the DFA. This could come particularly handy (naive to say) when TM are introduced into the package.

Solution:

Gargant0373 commented 4 months ago

Wouldn't it's formal representation be a good place to start from?

We could use JSON for it:

{
  "states": ["q0", "q1", "q2"],
  "alphabet": ["0", "1"],
  "transitions": {
    "q0": {
      "0": "q1",
      "1": "q0"
    },
    "q1": {
      "0": "q2",
      "1": "q0"
    },
    "q2": {
      "0": "q2",
      "1": "q2"
    }
  },
  "start_state": "q0",
  "accept_states": ["q2"]
}
Zakrok09 commented 4 months ago

@Gargant0373 certainly! Using a JSON format like this would be a solid start.

I believe that @vesk4000 had solution for some niche DFA representation used for the Quadruple Quest assignments at TU Delft. What was it there?

Edit: I forgot to mention, this project is labeled as good first issue. If you have the time to contribute, any contribution is gladly accepted.

vesk4000 commented 4 months ago

I believe that @vesk4000 had solution for some niche DFA representation used for the Quadruple Quest assignments at TU Delft. What was it there?

The format went something like this: ({q0,q1,q2},{a,b,c},{((q0,a),q0),((q0,b),q1),((q0,c),q2),((q1,a),q0),((q1,b),q1),((q1,c),q0),((q2,a),q0),((q2,b),q0),((q2,c),q0)},q0,{q0}). It's a tuple of the form: (States, Alphabet, Transitions, Start State, Accepting States).