public PrgState Execute(PrgState state) { MyIStack <IStmt> stk = state.GetExeStack(); stk.Push(snd); stk.Push(first); return(state); }
public PrgState OneStep(PrgState state) { MyIStack <IStmt> stk = state.GetExeStack(); if (stk.IsEmpty()) { throw new MyException("Stack is empty"); } IStmt crtStmt = stk.Pop(); return(crtStmt.Execute(state)); }
public PrgState Execute(PrgState state) { MyIStack <IStmt> stk = state.GetExeStack(); MyIDictionary <String, int> symtbl = state.GetSymTable(); if (exp.Eval(symtbl) != 0) { stk.Push(thenS); } else { stk.Push(elseS); } return(state); }
public PrgState Execute(PrgState state) { MyIStack <IStmt> stk = state.GetExeStack(); MyIDictionary <String, int> symTbl = state.GetSymTable(); int val = exp.Eval(symTbl); if (symTbl.IsDefinedU(id)) { symTbl.Update(id, val); } else { symTbl.Add(id, val); } return(state); }