public PrgState <T> Execute <T>(PrgState <T> state) { if (mExp.Eval(state.GetSymTable(), state.GetHeap()) > 0) { state.AddExeStack((T)(IStmt)this); state.AddExeStack((T)mStatement); } return(null); }
public PrgState <T> Execute <T>(PrgState <T> state) { if (mExp.Eval(state.GetSymTable(), state.GetHeap()) != 0) { state.AddExeStack((T)mThenS); } else { state.AddExeStack((T)mElseS); } return(null); }
public List <PrgState <T> > SetStateList(T stmt) { MyList output = new MyList(); MyDictionary symTable = new MyDictionary(); MyStack <T> exeStack = new MyStack <T>(); MyIHeap heap = new MyHeap(); PrgState <T> prog = new PrgState <T>(exeStack, symTable, output, heap, 1); prog.AddExeStack(stmt); List <PrgState <T> > progList = new List <PrgState <T> >(); progList.Add(prog); return(progList); }
public PrgState <T> Execute <T>(PrgState <T> state) { // MyIDictionary symTable = state.getSymTable(); // int var = switchStmt.getExp2().eval(symTable); // if(var - switchStmt.getExp1().eval(symTable) == 0) // if(var - switchStmt.getExp1().eval(symTable) == 0) // state.addExeStack(switchStmt.getStatement3()); // else state.addExeStack(switchStmt.getStatement1()); // else state.addExeStack(switchStmt.getStatement2()); IStmt stmt = new IfStmt(new ArithExp("-", mVarExp, mExp2), new IfStmt(new ArithExp("-", mVarExp, mExp1), mStatement3, mStatement1), mStatement2); state.AddExeStack((T)stmt); return(null); }
public PrgState <T> Execute <T>(PrgState <T> state) { state.AddExeStack((T)(IStmt) new AssignStmt(mVarName, new ArithExp("+", new VarExp(mVarName), new ConstExp(1)))); return(null); }