public string TextBoxPrint() { string s = "state id: " + id + "\n" + "ExeStack: {"; for (int i = 0; i < exeStack.GetLength(); i++) { s = s + exeStack.Get(i).ToStr() + " | "; } s = s + "} \n SymTbl: {"; for (int i = 0; i < symTable.ElementAt(0).GetLength(); i++) { s = s + symTable.ElementAt(0).Get(i).ToStr() + " ; "; } s = s + "} \n List: {"; for (int i = 0; i < output.Size(); i++) { s = s + output.Get(i) + " ; "; } s = s + "}\n" + "Heap: {"; for (int i = 0; i < heap.Size(); i++) { s = s + heap.Gett(i).content + " ; "; } s = s + "}\n\n"; return(s); }
public override int Eval(Stack <MyIDictionary <MyMap> > tbl, IHeap <HMap> heap) { int content = 0; int address = (int)tbl.ElementAt(0).Lookup(var); try { content = heap.Gett(address).content; } catch (MissingMemberException e) { return(-1); }; return(content); }
public PrgState Execute(PrgState state) { Stack <MyIDictionary <MyMap> > symTbl = state.GetSymTable(); IHeap <HMap> heap = state.GetHeap(); int address = symTbl.ElementAt(0).Lookup(this.var); try { HMap h = (HMap)heap.Gett(address); h.SetAddr(address); h.SetCont(exp.Eval(symTbl, heap)); } catch (MissingMemberException e) { } return(null); }