コード例 #1
0
ファイル: CompStmt.cs プロジェクト: pamhrituc/MAP
        public PrgState Execute(PrgState state)
        {
            MyIStack <IStmt> stk = state.GetExeStack();

            stk.Push(snd);
            stk.Push(first);
            return(state);
        }
コード例 #2
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));
        }
コード例 #3
0
        public PrgState Execute(PrgState state)
        {
            MyIStack <IStmt>            stk    = state.GetExeStack();
            MyIDictionary <String, int> symtbl = state.GetSymTable();

            if (exp.Eval(symtbl) != 0)
            {
                stk.Push(thenS);
            }
            else
            {
                stk.Push(elseS);
            }
            return(state);
        }
コード例 #4
0
        public PrgState Execute(PrgState state)
        {
            MyIStack <IStmt>            stk    = state.GetExeStack();
            MyIDictionary <String, int> symTbl = state.GetSymTable();
            int val = exp.Eval(symTbl);

            if (symTbl.IsDefinedU(id))
            {
                symTbl.Update(id, val);
            }
            else
            {
                symTbl.Add(id, val);
            }
            return(state);
        }