-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathopg_analysis.cpp
More file actions
42 lines (38 loc) · 911 Bytes
/
Copy pathopg_analysis.cpp
File metadata and controls
42 lines (38 loc) · 911 Bytes
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
// =====================================================================================
//
// Filename: opg_analysis.cpp
//
// Description: 算符优先分析法
//
// Version: 1.0
// Created: 2014年05月07日 21时14分58秒
// Revision: none
// Compiler: g++
//
// Author: ZhangRui, v.me-zr@live.cn
// Company: Class 1107 of Computer Science and Technology
//
// =====================================================================================
#include "grammar.h"
int main(int argc, char *argv[])
{
OperatorGrammar opg;
opg.input_grammar();
if (opg.legal_grammar() == -1) {
return -1;
}
opg.char_terminator();
opg.trans_grammar();
opg.firstvt();
opg.lastvt();
if(opg.table() == -1) {
return -1;
}
std::cout << "需要进行句型分析请输入y\n";
char c;
std::cin >> c;
if (c == 'y') {
opg.deal();
}
return 0;
}