public LL1AnalysisForm() { InitializeComponent(); lblHint.ForeColor = Color.Red; lblHint1.ForeColor = Color.Red; LL1Helper.Reset(); }
private void tsbtnLL1Parsing_Click(object sender, EventArgs e) { if (!LL1Helper.isChecked) { MessageBox.Show("请先执行文法的预处理和检查操作!", "提示", MessageBoxButtons.OKCancel, MessageBoxIcon.Information); return; } if (LL1Helper.existedLeftRecursion && LL1Helper.existedLeftFactor) { MessageBox.Show("当前文法规则存在左递归和左公共因子,需要先消除!", "提示", MessageBoxButtons.OKCancel, MessageBoxIcon.Information); return; } else if (LL1Helper.existedLeftRecursion) { MessageBox.Show("当前文法规则存在左递归,需要先消除!", "提示", MessageBoxButtons.OKCancel, MessageBoxIcon.Information); return; } else if (LL1Helper.existedLeftFactor) { MessageBox.Show("当前文法规则存在左公共因子,需要先消除!", "提示", MessageBoxButtons.OKCancel, MessageBoxIcon.Information); return; } if (!LL1Helper.isTableGenerated) { MessageBox.Show("当前文法规则的LL(1)分析表还未生成,需要先生成该表!", "提示", MessageBoxButtons.OKCancel, MessageBoxIcon.Information); return; } String sentence = txtSentence.Text; if (sentence.Equals("")) { MessageBox.Show("输入语句不能为空!", "错误", MessageBoxButtons.OKCancel, MessageBoxIcon.Warning); } else { LL1Helper.DisplayLL1Parsing(sentence, dgvLL1Parsing); } }
private void tsbtnGenerateLL1ParsingTable_Click(object sender, EventArgs e) { LL1Helper.GenerateLL1ParsingTable(dgvLL1ParsingTable); }
private void tsbtnLeftFactoring_Click(object sender, EventArgs e) { LL1Helper.LeftFactoring(rtxtLeftFactoring); }
private void tsbtnLeftRecursionRemoval_Click(object sender, EventArgs e) { LL1Helper.LeftRecursionRemoval(rtxtLeftRecursionRemoval); }
private void tsbtnCheckGrammar_Click(object sender, EventArgs e) { LL1Helper.CheckGrammar(rtxtGrammar); }