#include <iostream>
#include "Functor.h"
#include <string>
using namespace std;
void main()
{
int num=7;
int num1=3;
char **table;
table=new char *[num];
for(int i=0;i<num;i++)
{
table[i]=new char [num];
for(int j=0;j<num;j++)
{
table[i][j]=NULL;
}
}
table[0][1]='+';
table[0][2]='*';
table[0][3]='i';
table[0][4]='(';
table[0][5]=')';
table[0][6]='$';
table[1][0]='+';
table[1][1]='>';
table[1][2]='<';
table[1][3]='<';
table[1][4]='<';
table[1][5]='>';
table[1][6]='>';
table[2][0]='*';
table[2][1]='>';
table[2][2]='>';
table[2][3]='<';
table[2][4]='<';
table[2][5]='>';
table[2][6]='>';
table[3][0]='i';
table[3][1]='>';
table[3][2]='>';
table[3][5]='>';
table[3][6]='>';
table[4][0]='(';
table[4][1]='<';
table[4][2]='<';
table[4][3]='<';
table[4][4]='<';
table[4][5]='=';
table[5][0]=')';
table[5][1]='>';
table[5][2]='>';
table[5][5]='>';
table[5][6]='>';
table[6][0]='$';
table[6][1]='<';
table[6][2]='<';
table[6][3]='<';
table[6][4]='<';
table[6][6]='=';
string ** css;
css=new string * [num1];
for(int i=0;i<num1;i++)
{
css[i]=new string [6];
for(int j=0;j<5;j++)
{
css[i][j]="";
}
}
css[0][0]="E";
css[0][1]="E+T";
css[0][2]="T+T";
css[0][3]="T";
css[0][4]="F+F";
css[1][0]="T";
css[1][1]="T*F";
css[1][2]="F*F";
css[1][3]="F";
css[2][0]="F";
css[2][1]="(E)";
css[2][2]="i";
string prog;
cout<<"请输入待分析字符串:"<<endl;
cin>>prog;
Functor myFun(num,num1,table,css,prog);
myFun.traversal();
system("pause");
}
算符优先分析法 C++ 编译原理
4星 · 超过85%的资源 需积分: 9 8 浏览量
2010-04-19
10:53:16
上传
评论
收藏 2KB RAR 举报
梦轩闲骨
- 粉丝: 3
- 资源: 13
最新资源
- 基于yolov5识别算法实现的DNF自动脚本源码.zip
- 基于Python实现的自动化办公项目.zip
- 基于python实现的基于PyQt5和爬虫的小说阅读系统.zip
- 机械设计整经机上纱自动化sw20非常好的设计图纸100%好用.zip
- Screenshot_20240427_031602.jpg
- 网页PDF_2024年04月26日 23-46-14_QQ浏览器网页保存_QQ浏览器转格式(6).docx
- 直接插入排序,冒泡排序,直接选择排序.zip
- 在排序2的基础上,再次对快排进行优化,其次增加快排非递归,归并排序,归并排序非递归版.zip
- 实现了7种排序算法.三种复杂度排序.三种nlogn复杂度排序(堆排序,归并排序,快速排序)一种线性复杂度的排序.zip
- 冒泡排序 直接选择排序 直接插入排序 随机快速排序 归并排序 堆排序.zip
资源上传下载、课程学习等过程中有任何疑问或建议,欢迎提出宝贵意见哦~我们会及时处理!
点击此处反馈