static void Main(string[] args) { var parser = new SimpleParser(); do { Console.WriteLine("Input:"); var input = Console.ReadLine(); var result = parser.Parse(input); Console.WriteLine($"Result: {result}\n"); } while (true); }
private Node<string> CallParse() { if (txtInput.Text.Length == 0) { AddTextLineToOutput("No input specified", Color.Red); return null; } var parser = new SimpleParser(lexer); try { parser.Parse(txtInput.Text); RenderTree(parser.SyntaxTree); AddTextLineToOutput("Parsing succeeded", Color.DarkGreen); return parser.SyntaxTree; } catch (ParserException ex) { AddTextLineToOutput(ex.Message, Color.Red); return null; } }