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));
        }
Beispiel #2
0
        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);
        }
Beispiel #3
0
 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();
     }
 }
Beispiel #4
0
 public override int Eval(MyIDictionary <String, int> tbl)
 {
     return(tbl.Lookup(this.id));
 }