// ProgramSyntax Program() { var program = new ProgramSyntax(); while (Statement() is var statement && statement != null) { program.Children.Add(statement); } return(program); }
public static void PrintParseTree(ProgramSyntax syntaxTree) { if (syntaxTree != null) { PrintPretty(syntaxTree, "", true, true); } else { Console.WriteLine("(empty)"); } }
public override ProgValue Visit(ProgramSyntax syntax) { _logger.Log("PROGRAM BEGIN"); _symbolTable.EnterScope(); _logger.Indent(); foreach (var statement in syntax.Statements) { statement.Accept(this); } _logger.Unindent(); _symbolTable.LeaveScope(); _logger.Log("PROGRAM END"); return(NoneValue.Value); }