Beispiel #1
0
        public override object VisitProg([NotNull] MipsAsmParser.ProgContext context)
        {
            ProgramInfo prog = new ProgramInfo();
            int         i    = 0;

            for (i = 0; i < context.ChildCount; i++)
            {
                Statement statement = (Statement)Visit(context.stat(i));
                if (statement == null)
                {
                    continue;
                }
                prog.Statements.Add(statement);
                // to check if there is other instrutions attached to this instruction
                // pseudo instruction could be split to several intructions
                Instruction instruction = statement.Instruction;
                while (instruction.NextInstruction != null)
                {
                    instruction = instruction.NextInstruction;
                    Statement subStatement = new Statement();
                    subStatement.Instruction = instruction;
                    prog.Statements.Add(subStatement);
                }
            }
            return(prog);
        }
Beispiel #2
0
 /// <summary>
 /// Exit a parse tree produced by <see cref="MipsAsmParser.prog"/>.
 /// <para>The default implementation does nothing.</para>
 /// </summary>
 /// <param name="context">The parse tree.</param>
 public virtual void ExitProg([NotNull] MipsAsmParser.ProgContext context)
 {
 }
Beispiel #3
0
 /// <summary>
 /// Visit a parse tree produced by <see cref="MipsAsmParser.prog"/>.
 /// <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 VisitProg([NotNull] MipsAsmParser.ProgContext context)
 {
     return(VisitChildren(context));
 }