Пример #1
0
        public override void gen(int b, int a)
        {
            if (stmt1 == Stmt.Null)
            {
                stmt2.gen(b, a);
            }
            else if (stmt2 == Stmt.Null)
            {
                stmt1.gen(b, a);
            }
            else
            {
                int label = newlabel();
                stmt1.gen(b, label);
                emitlabel(label);
                stmt2.gen(label, a);
            }

            /*
             * if (stmt1 !=Stmt.Null)
             *  for(int i=0; i<stmt1.rows.Count;i++)
             *  {
             *      outputRows.Add(stmt1.rows[i]);
             *  }
             * if (stmt2 != Stmt.Null)
             *  for (int i = 0; i < stmt2.rows.Count; i++)
             *  {
             *      outputRows.Add(stmt2.rows[i]);
             *  }
             */
        }
Пример #2
0
        public override void gen(int b, int a)
        {
            int label = newlabel();

            expr.jumping(0, a);
            emitlabel(label);
            stmt.gen(label, a);
        }
Пример #3
0
        public override void gen(int b, int a)
        {
            int label = newlabel(); // label for the code for stmt

            expr.jumping(0, a);     // fall through on true, goto a on false
            emitlabel(label);
            stmt.gen(label, a);
        }
Пример #4
0
 public override void gen(int b, int a)
 {
     if (stmt1 == Stmt.Null)
     {
         stmt2.gen(b, a);
     }
     else if (stmt2 == Stmt.Null)
     {
         stmt1.gen(b, a);
     }
     else
     {
         int label = newlabel();
         stmt1.gen(b, label);
         emitlabel(label);
         stmt2.gen(label, a);
     }
 }
Пример #5
0
        public override void gen(int b, int a)
        {
            after = a;
            int label = newlabel();

            stmt.gen(b, label);
            emitlabel(label);
            expr.jumping(b, 0);
        }
Пример #6
0
        public override void gen(int b, int a)
        {
            after = a;                // save label a
            expr.jumping(0, a);
            int label = newlabel();   // label for stmt

            emitlabel(label); stmt.gen(label, b);
            emit("goto L" + b);
        }
Пример #7
0
        public override void gen(int b, int a)
        {
            int label1 = newlabel();
            int label2 = newlabel();

            expr.jumping(0, label2);
            emitlabel(label1);
            stmt1.gen(label1, a);
            emit("goto L" + a);
            emitlabel(label2);
            stmt2.gen(label2, a);
        }
Пример #8
0
        public override void gen(int b, int a)
        {
            int label1 = newlabel();   // label1 for stmt1
            int label2 = newlabel();   // label2 for stmt2

            expr.jumping(0, label2);   // fall through to stmt1 on true
            emitlabel(label1);
            stmt1.gen(label1, a);
            emit("goto L" + a);
            emitlabel(label2);
            stmt2.gen(label2, a);
        }