Devorein/fauton

Check that DFA can have only 1 state for a symbol

Opened this issue · 0 comments

Right now when creating a dfa the transition map allows a state to have an array of states for a symbol. For example

const { DeterministicFiniteAutomaton } = require('fauton');
const path = require('path');

const startsWithBC = new DeterministicFiniteAutomaton(
	(inputString) => inputString.startsWith('bc'),
	{
		alphabets: ['a', 'b'],
		transitions: {
			// Passing an array of states for symbol 'a', but it can only be an individual state for a dfa
			// array of states is only valid for a nfa
			A: [['B', 'A'], 'A'],
			B: ['A', 'B'],
		},
	}
);

Ideally, the user should get an error message when this issue occurs as this is an invalid dfa. At this moment of the package 0.0.3, this issue doesn't throw an error and acts as if the automaton is a nfa