void Compile() { ClearLog(); richTextBoxOutput.Clear(); FinalExpr = null; FinalBlock = null; FinalExpressable = null; var enc = new UTF8Encoding(false); using (var sr = new StreamReader(new MemoryStream(enc.GetBytes(richTextBoxInput.Text)))) using (var sb = new SyntaxBuilder(Cfe, sr, SelectedScope)) { while (sb.Step()) { ; } foreach (var msg in sb.Warns) { Log(msg.Msg, Color.DarkOrange, msg.Location); } foreach (var msg in sb.Errors) { Log(msg.Msg, Color.LightPink, msg.Location); } if (!sb.Success) { Log("Compiling failed!", Color.Pink); return; } else { Log("Compile Successful!", Color.LightSeaGreen); if (SelectedScope == ScopeMode.Expression) { FinalExpr = sb.Syn.CreateFinalExpression(); } else if (SelectedScope == ScopeMode.Function) { FinalBlock = sb.Syn.CreateFinalFunction().RootStatement; } FinalExpressable = sb.GetExpressable(); richTextBoxOutput.Text = FinalExpressable.Express(0); } } }