-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.cpp
32 lines (30 loc) · 850 Bytes
/
main.cpp
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
# pragma once
# include <iostream>
# include <string>
# include "config.h"
# include "CvtExp.h"
# include "SymbolGraph.h"
# include "DepthFirstOrder.h"
using namespace std;
int main(){
/**
* first step: convert expressions to edges that implys precedence constraints and put edges into another file.
*/
CvtExp converter(expFile,edgeFile);// parameters are configured in config.h
converter.cstctEdgeFile();
/**
* second step: use edges to create a digraph that uses string as the vertex name(symbol digraph).
*/
SymbolGraph SG(edgeFile);
DepthFirstOrder dfo(&SG);
stack<string>* reversePost = dfo.reversePost();
cout << "The topological sort order is:" << endl;
while (!reversePost->empty())
{
cout << reversePost->top() << " ";
reversePost->pop();
}
cout << endl;
//system("pause");
return 0;
}