public PrgState oneStep(PrgState state) { MyIStack <IStmt> stk = state.getStk(); IStmt crtStmt = stk.pop(); return(crtStmt.execute(state)); }
public PrgState execute(PrgState state) { MyIStack <IStmt> stk = state.getStk(); stk.push(second); stk.push(first); return(null); }
public PrgState execute(PrgState state) { MyIStack <IStmt> stk = state.getStk(); MyIDictionary <string, int> symTable = state.getSymTable(); if (exp.Eval(symTable) != 0) { stk.push(thenStatement); } else { stk.push(elseStatement); } return(null); }
public PrgState execute(PrgState state) { MyIStack <IStmt> stack = state.getStk(); MyIDictionary <string, int> symTable = state.getSymTable(); int val = exp.Eval(symTable); if (symTable.isDefined(id)) { symTable.update(id, val); } else { symTable.put(id, val); } return(null); }