Skip to content

Fast and effective automaton software that can simulate acceptance tests in a state machine style also providing support for validation, minimization and complement generation.

License

felixklauke/winchester

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

28 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

winchester

Fast and effective finite automaton software that can simulate acceptance tests in a state machine style.

Example

Creation and simple word test:

auto states = std::set<State>();
auto startState = State(0, "q0", false);
auto secondState = State(1, "q1", false);
auto thirdState = State(2, "q2", true);

states.insert(startState);
states.insert(secondState);
states.insert(thirdState);

auto alphabet = std::set<char>();
alphabet.insert('a');
alphabet.insert('b');
alphabet.insert('c');

auto transitions = std::map<State, std::set<Transition>>();

auto dfa = DFA(states, alphabet, transitions, startState);
dfa.AddTransition(startState, Transition('a', secondState));
dfa.AddTransition(startState, Transition('b', startState));
dfa.AddTransition(startState, Transition('c', startState));

dfa.AddTransition(secondState, Transition('a', secondState));
dfa.AddTransition(secondState, Transition('b', thirdState));
dfa.AddTransition(secondState, Transition('c', startState));

dfa.AddTransition(thirdState, Transition('a', thirdState));
dfa.AddTransition(thirdState, Transition('b', thirdState));
dfa.AddTransition(thirdState, Transition('c', thirdState));

auto accepted = dfa.ProcessInput("abaaaacab");
std::cout << "Accepted: " << accepted << std::endl;

Create the complement (Accepts all words the former language didn't accept and vice versa):

auto complement = dfa.BuildComplement();

About

Fast and effective automaton software that can simulate acceptance tests in a state machine style also providing support for validation, minimization and complement generation.

Topics

Resources

License

Code of conduct

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published