#include<stdio.h>
#include<string>
#include<iostream>
#include<algorithm>
#include<stack>
using namespace std;
int num;
stack<char> A;
stack<char> B;
int f(char x,char y)
{
if(x == 'E'&&(y == 'i' || y=='('))
{
cout<<num<<" "<<"E->TG"<<endl;
A.pop();
A.push('G');
A.push('T');
num++;
return 1;
}
else if(x == 'G'&&y=='+')
{
cout<<num<<" "<<"G->+TG"<<endl;
A.pop();
A.push('G');
A.push('T');
A.push('+');
num++;
return 1;
}
else if(x == 'G'&&(y ==')' || y == '#'))
SDUT 表达式语法分析——预测分析法
最新推荐文章于 2017-12-05 10:11:45 发布