📄 yufa.cs
字号:
}
} while (table[getid(zhan[j]), getid(op)] == '>' || table[getid(zhan[j]), getid(op)] == '=' || table[getid(zhan[j]), getid(op)] == 'e');//直到temp[j]的优先级<temp[op]
putout = putout + " "+zhan[j] + " "+table[getid(zhan[j]), getid(temp)]+" " + temp +" ";
putout = putout + zhan[j] + " "+table[getid(zhan[j]), getid(op)]+" " + op + "\r\n";
arr = null;
for (m = j + 1; m <= k; m++)//归约
{
arr = arr + zhan[m];
zhan[m] = ' ';
}
zhan[j + 1] = 'N';
putout = putout + " 将 " + arr + " 归约为 "+zhan [j+1];
arr = null;
for (s = 0; s <= j + 1; s++)
arr = arr + zhan[s];
putout = putout + " 栈的内容为" + arr + "\r\n";
k = j + 1;
}
if (table[getid(zhan[j]), getid(temp)] == '<' || table[getid(zhan[j]), getid(temp)] == '=')
{
k = k + 1;
zhan[k] = temp; //入栈
putout = putout +" "+zhan[j] + " "+table[getid(zhan[j]), getid(temp)]+" " + temp + "\r\n";
putout = putout + " "+zhan[k] + " 入栈 ";
arr=null;
for (s = 0; s <= k; s++)
arr = arr + zhan[s];
putout = putout + " 栈的内容为:" + arr + "\r\n\r\n";
}
else
{
TOut.Text = "出错";
break;
}
i++;
} while (Arrayget[i] != '!');
if (find == 0)
TOut.Text = null;
else
{
if (arr != "#N#")
TOut.Text = putout + "分析失败";
else
TOut.Text = putout + "分析成功";
}
}
}
private void Bopen_Click(object sender, EventArgs e)//用于测试的优先表
{
T1.Text = "+";
T2.Text = "-";
T3.Text = "*";
T4.Text = "/";
T5.Text = "(";
T6.Text = ")";
T7.Text = "i";
T8.Text = "#";
T9.Text = "+";
T10.Text = "-";
T11.Text = "*";
T12.Text = "/";
T13.Text = "(";
T14.Text = ")";
T15.Text = "i";
T16.Text = "#";
a11.Text = ">";
a12.Text = ">";
a13.Text = "<";
a14.Text = "<";
a15.Text = "<";
a16.Text = ">";
a17.Text = "<";
a18.Text = ">";
a21.Text = ">";
a22.Text = ">";
a23.Text = "<";
a24.Text = "<";
a25.Text = "<";
a26.Text = ">";
a27.Text = "<";
a28.Text = ">";
a31.Text = ">";
a32.Text = ">";
a33.Text = ">";
a34.Text = ">";
a35.Text = "<";
a36.Text = ">";
a37.Text = "<";
a38.Text = ">";
a41.Text = ">";
a42.Text = ">";
a43.Text = "<";
a44.Text = "<";
a45.Text = "<";
a46.Text = ">";
a47.Text = "<";
a48.Text = ">";
a51.Text = "<";
a52.Text = "<";
a53.Text = "<";
a54.Text = "<";
a55.Text = "<";
a56.Text = "=";
a57.Text = "<";
a58.Text = "e";
a61.Text = ">";
a62.Text = ">";
a63.Text = ">";
a64.Text = ">";
a65.Text = "e";
a66.Text = ">";
a67.Text = "e";
a68.Text = ">";
a71.Text = ">";
a72.Text = ">";
a73.Text = ">";
a74.Text = ">";
a75.Text = "e";
a76.Text = ">";
a77.Text = "e";
a78.Text = ">";
a81.Text = "<";
a82.Text = "<";
a83.Text = "<";
a84.Text = "<";
a85.Text = "<";
a86.Text = "e";
a87.Text = "<";
a88.Text = "=";
}
private void juzi1_Click(object sender, EventArgs e)
{
Code.Text = "i*(i-(i+i)/i)";
}
private void juzi2_Click(object sender, EventArgs e)
{
Code.Text = "((i)))";
}
private void clear_Click(object sender, EventArgs e)//清空所有
{
T1.Text = null;
T2.Text = null;
T3.Text = null;
T4.Text = null;
T5.Text = null;
T6.Text = null;
T7.Text = null;
T8.Text = "#";
T9.Text = null;
T10.Text = null;
T11.Text = null;
T12.Text = null;
T13.Text = null;
T14.Text = null;
T15.Text = null;
T16.Text = "#";
a11.Text = null;
a12.Text = null;
a13.Text = null;
a14.Text = null;
a15.Text = null;
a16.Text = null;
a17.Text = null;
a18.Text = null;
a21.Text = null;
a22.Text = null;
a23.Text = null;
a24.Text = null;
a25.Text = null;
a26.Text = null;
a27.Text = null;
a28.Text = null;
a31.Text = null;
a32.Text = null;
a33.Text = null;
a34.Text = null;
a35.Text = null;
a36.Text = null;
a37.Text = null;
a38.Text = null;
a41.Text = null;
a42.Text = null;
a43.Text = null;
a44.Text = null;
a45.Text = null;
a46.Text = null;
a47.Text = null;
a48.Text = null;
a51.Text = null;
a52.Text = null;
a53.Text = null;
a54.Text = null;
a55.Text = null;
a56.Text = null;
a57.Text = null;
a58.Text = null;
a61.Text = null;
a62.Text = null;
a63.Text = null;
a64.Text = null;
a65.Text = null;
a66.Text = null;
a67.Text = null;
a68.Text = null;
a71.Text = null;
a72.Text = null;
a73.Text = null;
a74.Text = null;
a75.Text = null;
a76.Text = null;
a77.Text = null;
a78.Text = null;
a81.Text = null;
a82.Text = null;
a83.Text = null;
a84.Text = null;
a85.Text = null;
a86.Text = null;
a87.Text = null;
a88.Text = null;
Code.Text = null;
TOut.Text = null;
}
private void clearjuzi_Click(object sender, EventArgs e)//清空要分析的句子
{
Code.Text = null;
}
private void yufa_Load(object sender, EventArgs e)
{
}
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -