Exemplo n.º 1
0
            public override void EnterProgram([NotNull] COOLParser.ProgramContext context)
            {
                base.EnterProgram(context);

                listener.rootSymbolTable = new SymbolTable(context.ToString());
                listener.depthTables.Push(listener.rootSymbolTable);

                //context.programBlocks()
            }
Exemplo n.º 2
0
 public override void ExitProgram([NotNull] COOLParser.ProgramContext context)
 {
     base.ExitProgram(context);
     Log("exit Program");
     if (phase == Phase.Building)
     {
         symbolTableCreator.ExitProgram(context);
     }
     else
     {
         symbolTableTraverser.ExitProgram(context);
         semanticErrorChecker.ExitProgram(context);
     }
 }
Exemplo n.º 3
0
 public override void EnterProgram([NotNull] COOLParser.ProgramContext context)
 {
     base.EnterProgram(context);
     depthTables.Clear();
     Log("enter Program");
     if (phase == Phase.Building)
     {
         symbolTableCreator.EnterProgram(context);
     }
     else
     {
         depthTables.Push(rootSymbolTable);
         symbolTableCreator.CheckSymbolTablesErrors();   //travers symbol tables hierarchy and check errors
         symbolTableTraverser.EnterProgram(context);
         semanticErrorChecker.EnterProgram(context);
     }
 }
Exemplo n.º 4
0
 /// <summary>
 /// Visit a parse tree produced by <see cref="COOLParser.program"/>.
 /// <para>
 /// The default implementation returns the result of calling <see cref="AbstractParseTreeVisitor{Result}.VisitChildren(IRuleNode)"/>
 /// on <paramref name="context"/>.
 /// </para>
 /// </summary>
 /// <param name="context">The parse tree.</param>
 /// <return>The visitor result.</return>
 public virtual Result VisitProgram([NotNull] COOLParser.ProgramContext context)
 {
     return(VisitChildren(context));
 }
Exemplo n.º 5
0
 /// <summary>
 /// Exit a parse tree produced by <see cref="COOLParser.program"/>.
 /// <para>The default implementation does nothing.</para>
 /// </summary>
 /// <param name="context">The parse tree.</param>
 public virtual void ExitProgram([NotNull] COOLParser.ProgramContext context)
 {
     System.Console.WriteLine("exit program");
 }
Exemplo n.º 6
0
        //TODO remove all Console.WriteLine() methods

        /// <summary>
        /// Enter a parse tree produced by <see cref="COOLParser.program"/>.
        /// <para>The default implementation does nothing.</para>
        /// </summary>
        /// <param name="context">The parse tree.</param>
        public virtual void EnterProgram([NotNull] COOLParser.ProgramContext context)
        {
        }