示例#1
0
        public PrgState oneStep(PrgState state)
        {
            MyIStack <IStmt> stk     = state.getStk();
            IStmt            crtStmt = stk.pop();

            return(crtStmt.execute(state));
        }
示例#2
0
        public PrgState execute(PrgState state)
        {
            MyIStack <IStmt> stk = state.getStk();

            stk.push(second);
            stk.push(first);
            return(null);
        }
示例#3
0
        public PrgState execute(PrgState state)
        {
            MyIStack <IStmt>            stk      = state.getStk();
            MyIDictionary <string, int> symTable = state.getSymTable();

            if (exp.Eval(symTable) != 0)
            {
                stk.push(thenStatement);
            }
            else
            {
                stk.push(elseStatement);
            }
            return(null);
        }
示例#4
0
        public PrgState execute(PrgState state)
        {
            MyIStack <IStmt>            stack    = state.getStk();
            MyIDictionary <string, int> symTable = state.getSymTable();
            int val = exp.Eval(symTable);

            if (symTable.isDefined(id))
            {
                symTable.update(id, val);
            }
            else
            {
                symTable.put(id, val);
            }
            return(null);
        }