https://github.com/felixklauke/winchester
Fast and effective automaton software that can simulate acceptance tests in a state machine style also providing support for validation, minimization and complement generation.
https://github.com/felixklauke/winchester
deterministic deterministic-finite-automata dfa dfa-construction dfa-minimization state-machine
Last synced: about 1 month ago
JSON representation
Fast and effective automaton software that can simulate acceptance tests in a state machine style also providing support for validation, minimization and complement generation.
- Host: GitHub
- URL: https://github.com/felixklauke/winchester
- Owner: felixklauke
- License: mit
- Created: 2018-02-20T11:07:42.000Z (over 8 years ago)
- Default Branch: dev
- Last Pushed: 2018-03-15T06:45:51.000Z (about 8 years ago)
- Last Synced: 2025-01-01T20:45:13.768Z (over 1 year ago)
- Topics: deterministic, deterministic-finite-automata, dfa, dfa-construction, dfa-minimization, state-machine
- Language: C++
- Homepage: http://felix-klauke.de
- Size: 45.9 KB
- Stars: 3
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Contributing: CONTRIBUTING.md
- License: LICENSE
- Code of conduct: CODE_OF_CONDUCT.md
Awesome Lists containing this project
README
# winchester
Fast and effective finite automaton software that can simulate acceptance tests in a state machine style.
# Example
_Creation and simple word test:_
```cpp
auto states = std::set();
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();
alphabet.insert('a');
alphabet.insert('b');
alphabet.insert('c');
auto transitions = std::map>();
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):_
```cpp
auto complement = dfa.BuildComplement();
```