-
Notifications
You must be signed in to change notification settings - Fork 0
/
DFA.h
39 lines (37 loc) · 1.25 KB
/
DFA.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
#ifndef DFA_H
#define DFA_H
#pragma once
#include <string>
#include <list>
#include "Transition.h"
using namespace std;
/**
* Deterministic finite automaton
* the main class which will be called to answer whither the
* input was accepted or not and handel all the transitions
*
*/
class DFA {
public:
// constractor
/**
* @list<string> Q: is a list of all the states {Q0, Q1, Q2, Q3, ...}
* @list<char> Sigma: is a list of all the allowed letters in it
* @list<Transition> Delta: is a list of all the transitions made in it
* @list<string> FinalState: is a list of all the final states in it
* @string Q0: is the name of the start state in it
*
*/
DFA(list<string> q, list<char> sigma, list<Transition> delta, string q0, list<string> finalstate);
// destructor
~DFA();
// check if the input was accepted or not
void Accepts(string input);
private:
list<string> Q; // is a list of all the states {Q0, Q1, Q2, Q3, ...}
list<char> Sigma; // is a list of all the allowed letters in it
list<Transition> Delta; // is a list of all the transitions made in it
list<string> FinalState; // is a list of all the final states in it
string Q0; // is the name of the start state in it
};
#endif // !DFA_H