예제 #1
0
        //
        ProgramSyntax Program()
        {
            var program = new ProgramSyntax();

            while (Statement() is var statement && statement != null)
            {
                program.Children.Add(statement);
            }
            return(program);
        }
예제 #2
0
 public static void PrintParseTree(ProgramSyntax syntaxTree)
 {
     if (syntaxTree != null)
     {
         PrintPretty(syntaxTree, "", true, true);
     }
     else
     {
         Console.WriteLine("(empty)");
     }
 }
예제 #3
0
 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);
 }