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(); } }
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); }
public override int evaluate(MyIDictionary <string, int> symTable) { return(symTable.get(id)); }