public override int Eval(MyIDictionary tbl, MyIHeap heap) { int heapAddr = tbl.Lookup(mVarName); try { heap.ContainsKey(heapAddr); } catch (ArgumentNullException npe) { throw new MyNullPointerException("Heap memory location unallocated"); } return(heap.Get(heapAddr)); }
public PrgState <T> Execute <T>(PrgState <T> state) { MyIHeap heap = state.GetHeap(); MyIDictionary symTable = state.GetSymTable(); if (symTable.IsDefined(mVarName)) { heap.Update(symTable.Lookup(mVarName), mExp.Eval(symTable, heap));; } else { throw new ArgumentException("Heap address undefined"); } return(null); }
public void show() { while (true) { PrintMenu(); Console.Write("Input the option: "); String key = Console.ReadLine(); Command com = commands.Lookup(key); if (com == null) { Console.WriteLine("Invalid Option"); continue; } com.Execute(); } }
public override int Eval(MyIDictionary <String, int> tbl) { return(tbl.Lookup(this.id)); }