-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.cpp
More file actions
44 lines (31 loc) · 1.17 KB
/
main.cpp
File metadata and controls
44 lines (31 loc) · 1.17 KB
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
40
41
42
43
44
#include <bits/stdc++.h>
#include "Parser.h"
#include "NDFA.h"
#include "MinimizedDFA.h"
#include "DFA.h"
#include "LexicalParser.h"
using namespace std;
int main(){
map<string,vector<string>> regularExpression, regularDefinition;
vector<string> keywords;
vector<char> puncuations;
vector<Graph*> graphes;
Parser parser = Parser();
parser.parse_CFG();
parser.parse_input_grammer(regularExpression,regularDefinition,puncuations,keywords);
parser.expand_nested_regular_defenition(regularDefinition);
parser.evaluate_regular_expressions(regularExpression,regularDefinition);
NDFA ndfa = NDFA();
ndfa.constructNDFA(regularExpression,graphes);
// print_graph(graphes);
DFA dfa = DFA();
dfa.construct_DFA(graphes);
// print_table();
MinimizedDFA minimizedDFA = MinimizedDFA();
minimizedDFA.minimize(regularExpression,dfa.get_table(),dfa.get_inputs());
minimizedDFA.construct_minimized_DFA(dfa.get_table());
minimizedDFA.print_minimzed_DFA(dfa.get_inputs());
parser.parse_input_program(keywords,puncuations,minimizedDFA.get_head());
parser.generate_leftmost_derivation_sentential();
return 0;
}