public ProgState execute(ProgState prog) { MyIStack <IStmt> stk = prog.getStk(); stk.push(st2); stk.push(st1); return(prog); }
public ProgState onestep(ProgState prog) { MyIStack <IStmt> stk = prog.getStk(); try { stk.isEmpty(); } catch (StackExceptions) { throw new StmtExecException("The program is over!!! \n"); } IStmt st = stk.pop(); if (flag == 1) { System.Console.WriteLine(st.ToString()); } try { return(st.execute(prog)); } catch (ControllerException e) { throw new StmtExecException(e); } }
public ProgState execute(ProgState prog) { MyIStack <IStmt> stk = prog.getStk(); MyIDictionary <string, int> dict = prog.getDict(); try { if (ex.eval(dict) > 0) { stk.push(thenS); } else { stk.push(elseS); } } catch (StmtExceptions e) { throw new ControllerException(e); } return(prog); }