Example #1
0
        private void RunProgram_Button_Click(object sender, RoutedEventArgs e)
        {
            if (_LL1.IsOkToCompile == true)
            {
                CodeDomProvider    CodeProvider = new CSharpCodeProvider();
                CompilerParameters Parameters   = new CompilerParameters(new[] { "System.dll" }, "AnalizorLL1Implementation.exe", true);
                Parameters.GenerateExecutable = true;
                CompilerResults Results = CodeProvider.CompileAssemblyFromSource(Parameters, _GrammarCode);

                if (Results.Errors.HasErrors)
                {
                    GrammarCodeWindow CodeWindow = new GrammarCodeWindow();
                    StringBuilder     Errors     = new StringBuilder();
                    foreach (CompilerError Error in Results.Errors)
                    {
                        Errors.Append(Error.ErrorText);
                        Errors.AppendLine();
                    }
                    CodeWindow.CodeTextBox.Text = Errors.ToString();
                    CodeWindow.Show();
                }
                else
                {
                    Process.Start(Results.PathToAssembly, null);
                    MessageBox.Show("Build succeeded!");
                }
            }
        }
Example #2
0
        private void Complie_Button_Click(object sender, RoutedEventArgs e)
        {
            if (_LL1.IsOkToCompile == true)
            {
                _LL1.ConstructTheTabel();
                _GrammarCode = _LL1.GenerateGrammarCode();

                GrammarCodeWindow CodeWindow = new GrammarCodeWindow();
                CodeWindow.CodeTextBox.Text = _GrammarCode;
                CodeWindow.Show();
            }
        }