Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
Devorein opened this issue Nov 13, 2021 · 0 comments
Open

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

Devorein opened this issue Nov 13, 2021 · 0 comments
Assignees
Labels
bug Something isn't working

Comments

@Devorein
Copy link
Member

Devorein commented Nov 13, 2021

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

@Devorein Devorein self-assigned this Nov 13, 2021
@Devorein Devorein added the bug Something isn't working label Nov 13, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant