Ejemplo n.º 1
0
        public override void gen(int begin, int after)
        {
            CurrentGenerator.Goto(after);
            foreach (var item in Params.ParamList)
            {
                if (item is OptParam)
                {
                    CurrentGenerator.OptParam(item as OptParam, (item as OptParam).DefaultValue, item.ParamType);
                }
                else
                {
                    CurrentGenerator.Param(item, item.ParamType);
                }
            }

            int label  = CurrentGenerator.AllocLabel();
            int label2 = CurrentGenerator.AllocLabel();

            ExitLabel = label2;
            CurrentGenerator.Label(label);
            CurrentGenerator.LabelFunc(this);
            Stmt.gen(begin, after);
            CurrentGenerator.LabelFuncEnd(this);
            CurrentGenerator.Label(ExitLabel);
            //CurrentGenerator.Return(null);
        }
Ejemplo n.º 2
0
        public override void gen(int begin, int after)
        {
            this.after = after;
            this.begin = begin;
            Expr.jumping(0, after);
            int label = CurrentGenerator.AllocLabel();

            CurrentGenerator.Label(label); Stmt.gen(label, begin);
            CurrentGenerator.Goto(begin);
        }
Ejemplo n.º 3
0
        public override void gen(int begin, int after)
        {
            int label1 = CurrentGenerator.AllocLabel();
            int label2 = CurrentGenerator.AllocLabel();

            Expr.jumping(0, label2);

            CurrentGenerator.Label(label1); Stmt1.gen(label1, after); CurrentGenerator.Goto(after);
            CurrentGenerator.Label(label2); Stmt2.gen(label2, after);
        }
Ejemplo n.º 4
0
 public override void jumping(int t, int f)
 {
     if (this == True && t != 0)
     {
         CurrentGenerator.Goto(t);
     }
     else if (this == False && f != 0)
     {
         CurrentGenerator.Goto(f);
     }
 }
Ejemplo n.º 5
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);
        }
Ejemplo n.º 6
0
 public virtual void emitjumps(Expr s, int truejump, int falsejump)
 {
     if (truejump != 0 && falsejump != 0)
     {
         CurrentGenerator.If(s, truejump);
         CurrentGenerator.Goto(falsejump.ToString());
     }
     else if (truejump != 0)
     {
         CurrentGenerator.If(s, truejump);
     }
     else if (falsejump != 0)
     {
         CurrentGenerator.IfFalse(s, falsejump);
     }
 }
Ejemplo n.º 7
0
 public override void gen(int begin, int after)
 {
     CurrentGenerator.Goto(Stmt.begin);
 }