Ejemplo n.º 1
0
        private void button1_Click(object sender, EventArgs e)
        {
            string   eR = textBox1.Text;
            string   post;
            Postfija pos = new Postfija(operandos, alfabeto);

            post          = pos.Postfija2(eR);
            textBox2.Text = post;
        }
Ejemplo n.º 2
0
        public List <string> Lexico()
        {
            string[] lineas = txt_Lenguaje.Lines;
            string[,] id;
            string[,] num;
            List <char> edosid  = new List <char>();
            List <char> edosnum = new List <char>();
            Postfija    pos     = new Postfija(operandos, alfabeto);

            textBox2.Text = pos.Postfija2(textBox4.Text);
            this.txtAutomataTransicion.Clear();
            this.txtAutomataTransicion.Refresh();
            this.txtAutomataTransicion.Text = this.automata.generaAFN(this.textBox2.Text);
            int A = this.automata.a.Count;

            this.LlenaTabla();
            id     = AFD2();
            edosid = Edos;
            List <char> ligasid = new List <char>();

            for (int i = 0; i < textBox2.Text.Length; i++)
            {
                if (alfabeto.Contains(textBox2.Text[i]))
                {
                    ligasid.Add(textBox2.Text[i]);
                }
            }
            dgvTransiciones_AFN.Rows.Clear();
            dgvTransiciones_AFN.Columns.Clear();
            dataGridView4.Rows.Clear();
            dataGridView4.Columns.Clear();
            textBox2.Text = pos.Postfija2(textBox5.Text);
            this.txtAutomataTransicion.Clear();
            this.txtAutomataTransicion.Refresh();
            this.txtAutomataTransicion.Text = this.automata.generaAFN(this.textBox2.Text);
            A = this.automata.a.Count;
            this.LlenaTabla();
            num     = AFD2();
            edosnum = Edos;
            List <char> ligasnum = new List <char>();

            for (int i = 0; i < textBox2.Text.Length; i++)
            {
                if (alfabeto.Contains(textBox2.Text[i]))
                {
                    ligasnum.Add(textBox2.Text[i]);
                }
            }
            dgvTransiciones_AFN.Rows.Clear();
            dgvTransiciones_AFN.Columns.Clear();
            dataGridView4.Rows.Clear();
            dataGridView4.Columns.Clear();
            textBox2.Text = "";
            lexicoB lexico = new lexicoB(lineas, id, num, ligasid, ligasnum, edosid, edosnum, EdosAcep[0], EdosAcep[1]);

            lexico.Clasifica();

            // oAnaLex.Inicia();
            //oAnaLex.Analiza(txt_Lenguaje.Text, textBox4.Text, textBox5.Text);
            dataGridView1.Rows.Clear();
            if (lexico.Lexema.Count > 0)
            {
                dataGridView1.Rows.Add(lexico.Lexema.Count);
            }
            for (int i = 0; i < lexico.Lexema.Count; i++)
            {
                dataGridView1.Rows[i].Cells[0].Value = lexico.Lexema[i];
                dataGridView1.Rows[i].Cells[1].Value = lexico.Token[i];
            }
            return(lexico.Error);
        }