资源推荐
资源详情
资源评论
/*
说明:
输入格式:
每行输入一个产生式,左部右部中间的→用空格代替。
非终结符等价于大写字母
^ 表示 空
输入到文件结束,或用 0 0 结尾。
Sample Input:
(习题5・3):
S MH
S a
H LSo
H ^
K dML
K ^
L eHf
M K
M bLM
0 0
*/
#include <iostream>
#include <string>
#include <map>
#include <set>
#include <vector>
using namespace std;
说明:
输入格式:
每行输入一个产生式,左部右部中间的→用空格代替。
非终结符等价于大写字母
^ 表示 空
输入到文件结束,或用 0 0 结尾。
Sample Input:
(习题5・3):
S MH
S a
H LSo
H ^
K dML
K ^
L eHf
M K
M bLM
0 0
*/
#include <iostream>
#include <string>
#include <map>
#include <set>
#include <vector>
using namespace std;
char l;
string r;
multimap<char, string> sentence; //存储产生式
multimap<string, char> senRever; //产生式逆转
set<char> ter; //非终结符集合
map<char, bool> toEmpty; //非终结符能否推出 空
bool flag;
set<char> fir; // 保存单个元素的first集
set<char> follow; //保存单个元素的follow集
vector<string> rightSide; //右部
char Begin;
bool capL(char c) //字母是否大写
{
if(c<='Z' && c>='A')
return true;
return false;
}
/*
bool lowerL(char c) //小写字母
{
if(c<='z' && c>='a')
return true;
return false;
}*/
bool CapLString(string s) // 大写 字符串
{
剩余8页未读,继续阅读










上传资源 快速赚钱
我的内容管理 展开
我的资源 快来上传第一个资源
我的收益
登录查看自己的收益我的积分 登录查看自己的积分
我的C币 登录后查看C币余额
我的收藏
已下载
下载帮助

看过该资源的人还看了
没有合适的资源?快使用搜索试试~ 我知道了~
安全验证
文档复制为VIP权益,开通VIP直接复制

- 1
- 2
- 3
- 4
- 5
- 6
- 7
前往页