String Vn[] = { "E", "E'", "T", "T'", "F" }; // 非终结符集
String Vt[] = { "i", "+", "*", "(", ")", "#" }; // 终结符集
String P[][] = new String[5][6]; // 预测分析表
String fenxi[] ; // 分析栈
int count = 1; // 步骤
int count1 = 1;//’分析栈指针
int count2 = 0, count3 = 0;//预测分析表指针
String inputString = ""; // 输入的字符串
boolean flag;
public void setCount(int count, int count1, int count2, int count3){
this.count = count;
this.count1 = count1;
this.count2 = count2;
this.count3 = count3;
flag = false;
}
public void setFenxi() { // 初始化分析栈
fenxi = new String[20];
fenxi[0] = "#";
fenxi[1] = "E";
}
public void setP() { // 初始化预测分析表
for (int i = 0; i < 5; i++) {
for (int j = 0; j < 6; j++) {
P[i][j] = "error";
}
}
P[0][0] = "->TE'";
P[0][3] = "->TE'";
P[1][1] = "->+TE'";
P[1][4] = "->ε";
P[1][5] = "->ε";
P[2][0] = "->FT'";
P[2][3] = "->FT'";
P[3][1] = "->ε";
P[3][2] = "->*FT'";
P[3][4] = "->ε";
P[3][5] = "->ε";
P[4][0] = "->i";
P[4][3] = "->(E)";