public PrgState oneStep(PrgState prgState)
        {
            MyIStack <IStmt> exeStack = prgState.getExeStack();

            if (exeStack.isEmpty())
            {
                throw new Exception("stack is empty");
            }
            return(exeStack.pop().execute(prgState));
        }
예제 #2
0
        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); }
        }
        private PrgState oneStep(PrgState state)
        {
            MyIStack <IStmt> stk = state.getStk();

            if (stk.isEmpty())
            {
                throw new MyStmtExecException("The stack is empty");
            }
            IStmt crtStmt = stk.pop();

            try {
                return(crtStmt.execute(state));
            }
            catch (MyException ex)
            {
                throw new MyStmtExecException("" + ex);
            }
        }