예제 #1
0
        public PrgState oneStep(PrgState state)
        {
            MyIStack <IStmt> stk = state.getExeStack();

            try
            {
                if (stk.empty())
                {
                    throw new Exception("Empty stack");
                }

                IStmt    crtStmt  = stk.pop();
                PrgState newState = crtStmt.execute(state);
                if (flag == 1)
                {
                    this.displayCrtPrgState(newState);
                }
                //repo.logPrgStateExec();
                return(newState);
            }
            catch (Exception ex)
            {
                throw new Exception(ex.Message);
            }
        }
예제 #2
0
        public PrgState oneStep(PrgState state)
        {
            MyIStack <IStmt> stk     = state.getStk();
            IStmt            crtStmt = stk.pop();

            return(crtStmt.execute(state));
        }
        public PrgState oneStep(PrgState prgState)
        {
            MyIStack <IStmt> exeStack = prgState.getExeStack();

            if (exeStack.isEmpty())
            {
                throw new Exception("stack is empty");
            }
            return(exeStack.pop().execute(prgState));
        }
예제 #4
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);
            }
        }