예제 #1
0
 public void show()
 {
     while (true)
     {
         printMenu();
         Console.WriteLine("Input the command: ");
         Command cmd = cmds.get(Console.ReadLine());
         if (cmd == null)
         {
             Console.WriteLine("Invalid command");
             continue;
         }
         cmd.execute();
     }
 }
예제 #2
0
        public override int eval(MyIDictionary <string, int> tbl)
        {
            //if (!tbl.isDefined(id))
            //	throw new MyStmtExecException("The id is not in the table: Exception thrown from VarExp");

            int val = 0;
            ICollection <string> keys = tbl.keys();

            for (int i = 0; i < keys.Count(); i++)
            {
                if (keys.ElementAt(i) == this.id)
                {
                    val = tbl.get(i);
                    break;
                }
            }
            return(val);
        }
예제 #3
0
 public override int evaluate(MyIDictionary <string, int> symTable)
 {
     return(symTable.get(id));
 }