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

📄 main.cpp

📁 C编译器
💻 CPP
字号:
#include <stack>

#include "globals.h"
#include "util.h"
#include "parser.h"

ifstream grammarfile;
DVec_str productions;
vector<string> terminals;
vecNter nonterminals;
DVec_int table;
vector< string> vec ;

stack<string> parseStack;
vector<string> inputStr;

int main()
{
	ifstream  grammarfile;
	ifstream sourcefile;

	string gname;
	string sname;

	cout << "Please input the grammar file name:";
	cin >>gname;
     gname = "grammar.txt";
	cout<< "\n Then now input the source file name:";
	cin >> sname;
	cout<<endl;
    sname = "source.txt";
	grammarfile.open(gname.c_str());
	sourcefile.open(sname.c_str());

	if( !grammarfile ) cout << "ERROR:Cannot open the garmmar file!\n";
	else if( !sourcefile ) cout <<  "ERROR:Cannot open the source file!\n";
	else 
	{
		makeFirstSet();
        makeFollowSet();
        makeTable();

		LL1parse( sourcefile );

	}//else
	return 0;
}//main

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -