Ejemplo n.º 1
0
        public Repo(IStmt S)
        {
            programs = new List <PrgState>();

            MyIStack <IStmt> stack = new MyLibStack <IStmt>();
            // MyIStack<String> stack = new MyLibStack();

            //MyIList<String> list = new MyArrayList();
            MyIList <int> list = new MyLibList <int>();

            //MyIDictionary<MyMap> dict = new MyLibDictionary<MyMap>();
            MyIDictionary <MyMap> d = new MyLibDictionary();

            Stack <MyIDictionary <MyMap> > dict = new Stack <MyIDictionary <MyMap> >();

            dict.Push(d);

            IHeap <HMap> heap = new Heap <HMap>();

            PrgState prog = new PrgState(stack, dict, list, S, heap);


            /*PrgState prog = new PrgState(stack, dict, list,
             *  new CompStmt
             *      (new AssignStmt("a", new ConstExp(0)),
             *
             *      new CompStmt(
             *              new IfStmt(
             *                      new rHExp("a"),
             *                      new AssignStmt("v", new ConstExp(2)),
             *                      new New("v", new ArithExp(
             *                                                      new ConstExp(1),
             *                                                      new RelationalOp(new ConstExp(1), new ConstExp(2), 1),
             *                                                      1))),
             *              new CompStmt(
             *                      new WhileStmt(
             *
             *                              new ConstExp(3),
             *                              new PrintStmt(new rHExp("a"))),
             *                      new CompStmt(
             *                              new WH("v", new RelationalOp(new ConstExp(1), new ConstExp(2), 1)),
             *                              new AssignStmt("y", new RH("v")))))), heap);
             *
             */
            programs.Add(prog);
        }
Ejemplo n.º 2
0
        PrgState IStmt.Execute(PrgState state)
        {
            MyIStack <IStmt> stack = new MyLibStack <IStmt>();
            Stack <MyIDictionary <MyMap> > symtable = state.GetSymTable();
            MyIList <int> printList = state.GetPrintList();
            IHeap <HMap>  h         = state.GetHeap();

            MyLibStack <IStmt> crtstm = new MyLibStack <IStmt>();


            PrgState childPrgState = new PrgState(stack, symtable, printList, stmt, h);

            childPrgState.id = state.id * 10;


            return(childPrgState);
        }