⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 getvnvt.cpp

📁 一个语法分析程序,C++写的,内含原码和exe文件. 开发工具:DEV-C
💻 CPP
字号:
#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 + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -