Ejemplo n.º 1
0
        public PrgState oneStep(PrgState state)
        {
            MyIStack <IStmt> stk     = state.getStk();
            IStmt            crtStmt = stk.pop();

            return(crtStmt.execute(state));
        }
Ejemplo n.º 2
0
        public PrgState execute(PrgState state)
        {
            MyIStack <IStmt> stk = state.getStk();

            stk.push(second);
            stk.push(first);
            return(null);
        }
Ejemplo n.º 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);
        }
Ejemplo n.º 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);
        }