Beispiel #1
0
 private void btnCompile_Click(object sender, EventArgs e)
 {
     txtOut.Text = "";
     Compiler.TokenParser p = new Compiler.TokenParser(txtIn.Text);
     ex = Compiler.Syntax.Program.Parse(p);
     if (ex == null)
     {
         if (Compiler.Syntax.Program.ErrorToken != null)
         {
             txtOut.Text = "Ln " + Compiler.Syntax.Program.ErrorToken.Line +
                           " Col " + Compiler.Syntax.Program.ErrorToken.Column + ": ";
         }
         else
         {
             txtOut.Text = "Ln " + p.Line +
                           " Col " + p.Column + ": ";
         }
         if (Compiler.Syntax.Program.ErrorDescription != null)
         {
             txtOut.Text += Compiler.Syntax.Program.ErrorDescription;
         }
         else
         {
             txtOut.Text += p.ErrorDescription;
         }
     }
     else
     {
         txtOut.Text = "Compilado com sucesso!";
     }
 }