main.cpp
来自「C编译器」· C++ 代码 · 共 47 行
CPP
47 行
#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 + =
减小字号Ctrl + -
显示快捷键?