コード例 #1
0
        public override void visit(While wstmt)
        {
            wstmt.predicate.accept(this);

            if (wstmt.predicate.type != Constants.BOOLEAN)
            {
                error(wstmt, "predicate doesn't evaluate to type Bool");
            }

            wstmt.body.accept(this);
            wstmt.type = Constants.OBJECT;
        }
コード例 #2
0
        public override void visit(While whil)
        {
            for (int i = 0; i < depth * 2; i++)
            {
                sw.Write(" ");
            }
            depth++;
            sw.WriteLine("_while : " + whil.type);

            whil.predicate.accept(this);
            whil.body.accept(this);

            depth--;
        }
コード例 #3
0
        public override void visit(While whilestmt)
        {
            ++while_count;

            emit_label("whileloop" + while_count.ToString());
            whilestmt.predicate.accept(this);
            emit_la("t1", "bool_const1");
            emit_bne("a0", "t1", "whileend" + while_count.ToString());

            whilestmt.body.accept(this);

            emit_b("whileloop" + while_count.ToString());
            emit_label("whileend" + while_count.ToString());
            emit_li("a0", 0);
        }
コード例 #4
0
 public abstract void visit(While whil);