예제 #1
0
 public T ExeStackPop()
 {
     T s;
     try
     {
         s = exeStack.Pop();
     }
     catch (DataTypesException e)
     {
         Console.WriteLine(e.StackTrace);
         throw new ExpException("Error at exeStackPop");
     }
     return s;
 }
예제 #2
0
        public ProgramState OneStep(ProgramState prgState)
        {
            MyIStack <IStatement> exeStack = prgState.getExecutionStack();

            if (exeStack.IsEmpty())
            {
                throw new Exception("stack is empty");
            }
            return(exeStack.Pop().Execute(prgState));
        }
예제 #3
0
        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));
        }
예제 #4
0
        private ProgramState ExecuteOneStep(ProgramState programState)
        {
            MyIStack <IStatement> executionStack = programState.ExecutionStack;

            if (executionStack.IsEmpty)
            {
                throw new InterpreterControllerException("Execution stack is empty!");
            }

            IStatement current = executionStack.Pop();

            return(current.Execute(programState));
        }
예제 #5
0
        public ProgramState OneStep(ProgramState state)
        {
            MyIStack <IStatement> st = state.GetExeStack();

            try
            {
                IStatement currentStatement = st.Pop();
                return(currentStatement.Execute(state));
            }
            catch (EmptyMyStackException)
            {
                throw new MyStatementExecutionException("Exception. Execution stack is empty.");
            }
        }
예제 #6
0
        public PrgState OneStep()
        {
            IStmt crtStmt = null;

            if (exeStack.IsEmpty())
            {
                Console.Write("empty stack!! \n");
                return(null);
            }
            else
            {
                crtStmt = exeStack.Pop();
            }

            return(crtStmt.Execute(this));
        }