Exemple #1
0
 public override void gen(int begin, int after)
 {
     if (Expr is FuncCall)
     {
         if (t == null)
         {
             emitfunSet(Expr, Id);
         }
         else
         {
             emitfunSet(Expr, t);
         }
     }
     else
     {
         if (t == null)
         {
             CurrentGenerator.Set(Id, Expr.gen());
         }
         else
         {
             CurrentGenerator.Set(t, Expr.gen());
         }
     }
 }
Exemple #2
0
        public override Expr reduce()
        {
            Expr x = gen();
            Temp t = new Temp(Type);

            CurrentGenerator.Temp(t);
            CurrentGenerator.Set(t, x);
            return(t);
        }
Exemple #3
0
        public override Expr gen()
        {
            int  f = CurrentGenerator.AllocLabel();
            int  a = CurrentGenerator.AllocLabel();
            Temp t = new Temp(Type);

            CurrentGenerator.Temp(t);
            jumping(0, f);
            CurrentGenerator.Set(t, Constant.True);
            CurrentGenerator.Goto(a);
            CurrentGenerator.Label(f);
            CurrentGenerator.Set(t, Constant.False);
            CurrentGenerator.Label(a);
            return(t);
        }