Skip to content

Check that DFA can have only 1 state for a symbol #1

Description

@Devorein

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

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions