public PrgState Execute(PrgState state) { IModDictionary <string, int> symbTable = state.SymbTable; int id = expFileId.Eval(symbTable); FileData fd = state.FileTable.Get(id); System.IO.StreamReader reader = fd.Header; reader.Close(); state.FileTable.Remove(id); return(state); }
public PrgState( IExeStack <IStmt> _exeStack, IModDictionary <string, int> _symbTable, IModList <int> _outList, IFileTable <int, FileData> _fileTable, IStmt _originalProgram ) { this.ExeStack = _exeStack; this.SymbTable = _symbTable; this.OutList = _outList; this.FileTable = _fileTable; this.OriginalProgram = _originalProgram; ExeStack.Push(OriginalProgram); }
public PrgState Execute(PrgState state) { IModDictionary <string, int> symbTable = state.SymbTable; int val = exp.Eval(symbTable); if (symbTable.Contains(id)) { symbTable.Update(id, val); } else { symbTable.Put(id, val); } return(state); }
public PrgState Execute(PrgState state) { IModDictionary<string, int> symbTable = state.SymbTable; IExeStack<IStmt> exeStack = state.ExeStack; int res = exp.Eval(symbTable); if (res != 0) { exeStack.Push(thenS); } else { exeStack.Push(elseS); } return state; }
public PrgState Execute(PrgState state) { int value; IModDictionary <string, int> symbTable = state.SymbTable; // int id = expFileId.Eval(symbTable); // FileData fd = state.FileTable.Get(id); System.IO.StreamReader reader = fd.Header; string line = reader.ReadLine(); if (line == null) { value = 0; } else { value = Int32.Parse(line); System.Console.WriteLine(">>>>>>>>>>>>>>> " + value); } if (symbTable.Contains(varName)) { symbTable.Update(varName, value); } else { symbTable.Put(varName, value); } return(state); }
public abstract int Eval(IModDictionary <string, int> symbTable);
public override int Eval(IModDictionary <string, int> symbTable) { return(number); }