Exemple #1
0
 public void allStep()
 {
     try {
         PState state = repo.getPState();
         // print
         System.Console.WriteLine(state.ToString());
         while (!state.getStack().isEmpty())
         {
             runStep(state);
             // print
             System.Console.WriteLine(state.ToString());
         }
     }
     catch (MyException myEx)
     {
         throw new MyException("CON_ERR: run step \\ " + myEx.Message);
     }
 }
Exemple #2
0
        public PState runStep(PState state)
        {
            IStack <IStatement> stk = state.getStack();

            // error
            if (stk.isEmpty())
            {
                throw new MyException("CON_ERR: reached empty stack");
            }
            try {
                IStatement stm = stk.pop();
                return(stm.execute(state));
            }
            catch (MyException myEx)
            {
                throw new MyException("EVAL_ERR: \\ " + myEx.Message);
            }
        }