Ejemplo n.º 1
0
 public ProgramState(MyIStack <IStatement> executionStack, MyIDictionary <string, int> symbolTable,
                     MyIList <int> output)
 {
     this.executionStack = executionStack;
     this.symbolTable    = symbolTable;
     this.output         = output;
 }
Ejemplo n.º 2
0
        public PrgState Execute(PrgState state)
        {
            MyIList <int> list = state.GetPrintList();

            list.Add1(exp.Eval(state.GetSymTable(), state.GetHeap()));
            return(null);
        }
Ejemplo n.º 3
0
 public PrgState(MyIStack<T> stk, MyIDictionary symtbl, MyIList ot, MyIHeap heap, int id)
 {
     exeStack = stk;
     @out = ot;
     symTable = symtbl;
     mHeap = heap;
     mId = id;
 }
Ejemplo n.º 4
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);
 }
Ejemplo n.º 5
0
 public ProgramState(IStatement statement)
 {
     executionStack = new MyStack <IStatement>(new Stack <IStatement>());
     executionStack.Push(statement);
     symbolTable = new MyDictionary <string, int>(new Dictionary <string, int>());
     outputList  = new MyList <int>(new List <int>());
     fileTable   = new MyDictionary <int, Tuple <string, TextReader> >(new Dictionary <int, Tuple <string, TextReader> >());
 }
Ejemplo n.º 6
0
 public Rep(MyIList <PrgState> prgStates)
 {
     this.prgStates = prgStates;
     this.crtPrg    = prgStates.get(0);
     //this.logFilePath = "/logfile.txt";
     this.logFilePath = "fil.txt";
     //this.logFilePath = "C: /Users/Anamaria - Dell/source/repos/ToyLanguageCS/ToyLanguageCS/logfile.txt";
 }
Ejemplo n.º 7
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> >());
 }
Ejemplo n.º 8
0
        public PrgState execute(PrgState state)
        {
            MyIList <int> ot = state.getOut();
            MyIDictionary <String, int> symTbl = state.getSymTable();

            ot.add(exp.eval(state.getSymTable()));
            return(state);
        }
Ejemplo n.º 9
0
        public PrgState execute(PrgState state)
        {
            MyIList <int> outList = state.getOutList();
            MyIDictionary <string, int> symTabel = state.getSymTable();

            outList.add(exp.Eval(symTabel));
            return(null);
        }
Ejemplo n.º 10
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);
 }
Ejemplo n.º 11
0
 public PrgState(MyIStack <IStmt> stk, MyIDictionary <String, int> symtbl, MyIList <int> ot, MyIDictionary <int, MyPair <String, StreamReader> > fT, IStmt prg)
 {
     exeStack  = stk;
     symTable  = symtbl;
     outList   = ot;
     fileTable = fT;
     exeStack.Push(prg);
 }
Ejemplo n.º 12
0
        public PrgState Execute(PrgState state)
        {
            MyIList <int> ot = state.GetOut();
            MyIDictionary <String, int> symtbl = state.GetSymTable();
            int val = exp.Eval(symtbl);

            ot.Add(val);
            return(state);
        }
Ejemplo n.º 13
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);
 }
Ejemplo n.º 14
0
 public PrgState(IStmt prg)
 {
     this.exeStack        = new MyStack <IStmt>();
     this.symTable        = new MyDictionary <String, int>();
     this.outTbl          = new MyList <int>();
     this.originalProgram = prg.deepCopy();
     this.fileTable       = new FileTable <int, FileTuple>();
     this.exeStack.push(prg);
 }
Ejemplo n.º 15
0
 public PrgState()
 {
     id              = 0;
     exeStack        = null;
     symTable        = null;
     output          = null;
     originalProgram = null;
     heap            = null;
 }
Ejemplo n.º 16
0
 public PrgState(MyIStack <IStmt> stk, MyIDictionary <string, int> symtbl,
                 MyIList <int> ot, IFileTable <int, FileTuple> fileTable, IStmt prg)
 {
     this.exeStack        = stk;
     this.symTable        = symtbl;
     this.outTbl          = ot;
     this.originalProgram = prg.deepCopy();
     this.fileTable       = fileTable;
     this.exeStack.push(prg);
 }
Ejemplo n.º 17
0
 public PrgState(MyIStack <IStmt> stk, Stack <MyIDictionary <MyMap> > symtbl, MyIList <int> otp, IStmt crtstm, IHeap <HMap> h)
 {
     id++;
     exeStack        = stk;
     symTable        = symtbl;
     output          = otp;
     originalProgram = crtstm;
     exeStack.Push(crtstm);
     heap = h;
 }
        public ProgramState(MyIStack <IStatement> exeStack, MyIDictionary <string, int> symTab,
                            MyIList <int> outList, MyIDictionary <int, MyPair <string, StreamReader> > fileTab,
                            IStatement originalProgram)
        {
            this.exeStack        = exeStack;
            this.symTab          = symTab;
            this.outList         = outList;
            this.fileTab         = fileTab;
            this.originalProgram = originalProgram;

            this.exeStack.Push(originalProgram);
        }
Ejemplo n.º 19
0
        public ProgState execute(ProgState prog)
        {
            MyIList <int> list = prog.getList();
            MyIDictionary <string, int> dict = prog.getDict();

            try {
                list.add(ex.eval(dict));
                return(prog);
            }
            catch (StmtExceptions e)
            {
                throw new ControllerException(e);
            }
        }
        public PrgState execute(PrgState state)
        {
            MyIList <int> list = state.getOut();
            MyIDictionary <string, int> dict = state.getSymTable();

            try
            {
                list.add(exp.eval(dict));
            }
            catch (MyException ex)
            {
                throw new MyException("" + ex);
            }
            return(state);
        }
Ejemplo n.º 21
0
        public ProgramState Execute(ProgramState state)
        {
            MyIList <int> outList = state.GetOutList();
            MyIDictionary <string, int> symTab = state.GetSymTab();

            try
            {
                outList.Enqueue(expr.Evaluate(symTab));
            }
            catch (ExpressionEvaluationException e)
            {
                Console.Write(e.ToString());
            }
            return(null);
        }
Ejemplo n.º 22
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);
        }
Ejemplo n.º 23
0
 public void setOut(MyIList <int> outTbl)
 {
     this.outTbl = outTbl;
 }
Ejemplo n.º 24
0
 public void SetOut(MyIList value)
     {
         @out = value;
     }
Ejemplo n.º 25
0
 public void setOut(MyIList <int> output)
 {
     this.output = output;
 }
Ejemplo n.º 26
0
 public Rep(MyIList <PrgState> prgStates, PrgState crtPrg)
 {
     this.prgStates = prgStates;
     this.crtPrg    = crtPrg;
 }
Ejemplo n.º 27
0
 public Rep(MyIList <PrgState> prgStates, String filename)
 {
     this.prgStates   = prgStates;
     this.crtPrg      = prgStates.get(0);
     this.logFilePath = filename;
 }
Ejemplo n.º 28
0
 public void SetOut(MyIList <int> ot)
 {
     this.outList = ot;
 }
Ejemplo n.º 29
0
 public void setList(MyIList <int> list)
 {
     this.list = list;
 }