Exemplo n.º 1
0
 public LL1AnalysisForm()
 {
     InitializeComponent();
     lblHint.ForeColor  = Color.Red;
     lblHint1.ForeColor = Color.Red;
     LL1Helper.Reset();
 }
Exemplo n.º 2
0
        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);
            }
        }
Exemplo n.º 3
0
 private void tsbtnGenerateLL1ParsingTable_Click(object sender, EventArgs e)
 {
     LL1Helper.GenerateLL1ParsingTable(dgvLL1ParsingTable);
 }
Exemplo n.º 4
0
 private void tsbtnLeftFactoring_Click(object sender, EventArgs e)
 {
     LL1Helper.LeftFactoring(rtxtLeftFactoring);
 }
Exemplo n.º 5
0
 private void tsbtnLeftRecursionRemoval_Click(object sender, EventArgs e)
 {
     LL1Helper.LeftRecursionRemoval(rtxtLeftRecursionRemoval);
 }
Exemplo n.º 6
0
 private void tsbtnCheckGrammar_Click(object sender, EventArgs e)
 {
     LL1Helper.CheckGrammar(rtxtGrammar);
 }