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));
        }
예제 #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);
        }
예제 #3
0
파일: TextMenu.cs 프로젝트: pamhrituc/MAP
 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();
     }
 }
예제 #4
0
파일: VarExp.cs 프로젝트: pamhrituc/MAP
 public override int Eval(MyIDictionary <String, int> tbl)
 {
     return(tbl.Lookup(this.id));
 }