#include
using namespace std;
struct Node1
{
char vn;
char vt;
char s[10];
}MAP[20];//儲存分析預測表每個位置對應的終結符,非終結符,產生式
int k;
//用R代表E",W代表T",e代表空
char G[10][10]={"E->TR","R->+TR","R->e","T->FW","W->*FW","W->e","F->(E)","F->i"};//儲存文法中的產生式
char VN[6]={"E","R","T","W","F"};//儲存非終結符
char VT[6]={"i","+","*","(",")","#"};//儲存終結符
char SELECT[10][10]={"(,i","+","),#","(,i","*","+,),#","(","i"};//儲存文法中每個產生式對應的SELECT集
char Right[10][8]={"->TR","->+TR","->e","->FW","->*FW","->e","->(E)","->i"};
stack
bool compare(char *a,char *b)
int i,la=strlen(a),j,lb=strlen(b);
for(i=0;i
#include
#include
#include
#include
#include
using namespace std;
struct Node1
{
char vn;
char vt;
char s[10];
}MAP[20];//儲存分析預測表每個位置對應的終結符,非終結符,產生式
int k;
//用R代表E",W代表T",e代表空
char G[10][10]={"E->TR","R->+TR","R->e","T->FW","W->*FW","W->e","F->(E)","F->i"};//儲存文法中的產生式
char VN[6]={"E","R","T","W","F"};//儲存非終結符
char VT[6]={"i","+","*","(",")","#"};//儲存終結符
char SELECT[10][10]={"(,i","+","),#","(,i","*","+,),#","(","i"};//儲存文法中每個產生式對應的SELECT集
char Right[10][8]={"->TR","->+TR","->e","->FW","->*FW","->e","->(E)","->i"};
stack
bool compare(char *a,char *b)
{
int i,la=strlen(a),j,lb=strlen(b);
for(i=0;i