Exemple #1
0
        public ProgState execute(ProgState prg)
        {
            IfStmt istmt = new IfStmt(new ArithExpr(var, "-", exp2), new IfStmt(new ArithExpr(var, "-", exp1), stm3, stm1), stm2);

            prg.GetExe.Push(istmt);
            return(null);
        }
Exemple #2
0
        public override ProgState execute(ProgState prg)
        {
            IStmt iss = new IfStmt(exp, thenStmt, new SkipStmt());

            prg.GetExe.Push(iss);
            return(null);
        }
Exemple #3
0
        public ProgState execute(ProgState prg)
        {
            int val = exp.Eval(prg.GetSym, prg.GetHeap);

            if (val != 0)
            {
                prg.GetExe.Push(this);
                prg.GetExe.Push(statement);
            }
            return(null);
        }
Exemple #4
0
        public ProgState execute(ProgState prg)
        {
            int val = expr.Eval(prg.GetSym, prg.GetHeap);

            if (val != 0)
            {
                prg.GetExe.Push(stmt1);
            }
            else
            {
                prg.GetExe.Push(stmt2);
            }
            return(null);
        }
Exemple #5
0
        public ProgState execute(ProgState prg)
        {
            int val = expr.eval(prg.GetSym, prg.GetHeap);

            try
            {
                int v = prg.GetSym.Get(id);
                prg.GetSym.Modify(id, val);
            }
            catch (VariableNotFoundException v)
            {
                prg.GetSym.Add(id, val);
            }
        }
Exemple #6
0
        public ProgState execute(ProgState prg)
        {
            int key;

            try
            {
                key = prg.GetSym.Get(var);
            }
            catch (VariableNotFoundException v)
            {
                throw v;
            }
            try
            {
                prg.GetHeap.Add(key, exp.Eval(prg.GetSym, prg.GetHeap));
            }
            catch (ArgumentException a)
            {
                prg.GetHeap.Modify(key, exp.Eval(prg.GetSym, prg.GetHeap));
            }
            return(null);
        }
Exemple #7
0
        public ProgState execute(ProgState prg)
        {
            int key;

            if (prg.GetHeap == null)
            {
                key = 1;
            }
            else
            {
                key = prg.GetHeap.Size() + 1;
            }
            prg.GetHeap.Add(key, exp.Eval(prg.GetSym, prg.GetHeap));
            try
            {
                prg.GetSym.Add(var, key);
            }
            catch (ArgumentException a)
            {
                prg.GetSym.Modify(var, key);
            }
            return(null);
        }
Exemple #8
0
        public ProgState execute(ProgState prg)
        {
            IStack <IStmt> stk = new ArrayStack <IStmt>();

            stk.Push(stm);
            IDict <string, int> dict = new ArrayDict <string, int>();
            int           i          = 0;
            List <string> keys       = new List <string>(prg.GetSym.GetKeys());

            int j = prg.GetSym.Size();

            while (i < j)
            {
                dict.Add(keys.ElementAt(i), prg.GetSym.Get(keys.ElementAt(i)));
                i++;
            }

            com.IList <int>  outer = prg.GetOut;
            IDict <int, int> heap  = prg.GetHeap;
            ProgState        prgg  = new ProgState(outer, dict, stk, heap);

            return(prgg);
        }
Exemple #9
0
 public ProgState execute(ProgState prg)
 {
     return(null);
 }
Exemple #10
0
 public ProgState execute(ProgState prg)
 {
     prg.GetExe.Push(second);
     prg.GetExe.Push(first);
     return(null);
 }
Exemple #11
0
 public ProgState execute(ProgState prg)
 {
     prg.GetOut.Add(expr.Eval(prg.GetSym, prg.GetHeap));
     return(null);
 }