예제 #1
0
        public PrgState execute(PrgState state)
        {
            MyIStack <IStmt> stk = state.getExeStack();

            stk.push(snd);
            stk.push(first);
            return(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 prgState)
        {
            MyIStack <IStmt> stk = prgState.getExeStack();

            stk.push(second);
            stk.push(first);
            return(prgState);
        }
예제 #4
0
        public ProgState execute(ProgState prog)
        {
            MyIStack <IStmt> stk = prog.getStk();

            stk.push(st2);
            stk.push(st1);
            return(prog);
        }
예제 #5
0
        public PrgState execute(PrgState prgState)
        {
            MyIStack <IStmt> stk = prgState.getExeStack();
            int val = this.exp.evaluate(prgState.getSymTable());

            if (val != 0)
            {
                stk.push(this.thenStmt);
            }
            else
            {
                stk.push(this.elseStmt);
            }
            return(prgState);
        }
예제 #6
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);
        }
예제 #7
0
 public ProgState(MyIStack <IStmt> stk, MyIDictionary <string, int> dict, MyIList <int> list, MyIFileTable <Tuple> fileT, IStmt prog)
 {
     this.stk   = stk;
     this.dict  = dict;
     this.list  = list;
     this.fileT = fileT;
     stk.push(prog);
 }
예제 #8
0
 public PrgState(MyIStack <IStmt> exeStack, MyIDictionary <string, int> symTable, MyIList <int> output, MyIFileDictionary <int, KeyValuePair <string, StreamReader> > fileTable, IStmt prg)
 {
     this.exeStack  = exeStack;
     this.symTable  = symTable;
     this.output    = output;
     this.fileTable = fileTable;
     exeStack.push(prg);
 }
예제 #9
0
 public PrgState(IStmt prg)
 {
     exeStack = new MyStack <IStmt>(new Stack <IStmt>());
     exeStack.push(prg);
     symTable  = new MyDictionary <string, int>(new Dictionary <string, int>());
     outList   = new MyList <int>(new List <int>());
     fileTable = new MyDictionary <int, Tuple <string, TextReader> >(new Dictionary <int, Tuple <string, TextReader> >());
 }
예제 #10
0
 public PrgState(IStmt prg)
 {
     exeStack        = new MyStack <IStmt>();
     symTable        = new MyDictionary <string, int>();
     outList         = new MyList <int>();
     fileTable       = new MyFileTable <int, Tuple <string, StreamReader> >();
     originalProgram = prg;
     exeStack.push(prg);
 }
예제 #11
0
        public ProgState execute(ProgState prog)
        {
            MyIStack <IStmt>            stk  = prog.getStk();
            MyIDictionary <string, int> dict = prog.getDict();

            try {
                if (ex.eval(dict) > 0)
                {
                    stk.push(thenS);
                }
                else
                {
                    stk.push(elseS);
                }
            } catch (StmtExceptions e) {
                throw new ControllerException(e);
            }
            return(prog);
        }
        public PrgState execute(PrgState state)
        {
            MyIDictionary <string, int> dict = state.getSymTable();
            MyIStack <IStmt>            stk  = state.getStk();

            try
            {
                if (exp.eval(dict) != 0)
                {
                    stk.push(thenS);
                }
                else
                {
                    stk.push(elseS);
                }
            }
            catch (MyException ex)
            {
                throw new MyException("" + ex);
            }
            return(state);
        }