getvnvt.cpp
来自「一个语法分析程序,C++写的,内含原码和exe文件. 开发工具:DEV-C」· C++ 代码 · 共 55 行
CPP
55 行
#include "global.h"
// import
list<string> VN;
list<string> VT;
void getVN()
{
for(int i = 0;i < lineno;i++)
VN.push_back(*(production[i].begin()));
if(!VN.empty()){
removeDup(VN); // remove duplicated elements
cout << "***********************************" << endl;
cout << "** The set of non-ternminal symbols of this grammer is as follow ** \n";
cout << "***********************************" << endl;
cout << endl;
print(VN);
cout << endl;
cout << "***********************************" << endl;
}
}
void getVT()
{
string tmp;
list<string>::iterator point,hold;
for(int i = 0;i < lineno;i++){
point = production[i].begin();
while(*point != "->")
point++;
hold = ++point;
while(hold != production[i].end()){
tmp = *hold;
if(tmp != "|" && !isIn(tmp,VN) && tmp != "e")
VT.push_back(*hold); // push to the set of VT
hold++;
}
}
if(!VT.empty()){
removeDup(VT);
cout << "***********************************" << endl;
cout << "** The set of terminal symbols of this grammer is as follow ** \n";
cout << "***********************************" << endl;
cout << endl;
print(VT);
cout << endl;
cout << "***********************************" << endl;
cout << endl;
}
}
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?