public PrgState(IDictionaryy <string, int> d, IExeStack <Statement> exes, IListt <int> ol, Statement s, FileTable <int, FileData> ft) { dict = d; stack = exes; outputList = ol; stmt = s; fileTable = ft; }
public int Eval(IDictionaryy <string, int> dict) { try { int l = left.Eval(dict); int r = right.Eval(dict); if (op == '+') { return(l + r); } if (op == '-') { return(l - r); } if (op == '*') { return(l * r); } else { if (r == 0) { throw new DivByZeroException("Division by zero !"); } else { return(l / r); } } throw new InexistentSymbolException("Inexistent symbol error !"); } catch (DivByZeroException e) { Console.WriteLine(e.Message); } catch (EvaluationException e2) { Console.WriteLine(e2.Message); } catch (InexistentSymbolException e3) { Console.WriteLine(e3.Message); } return(-1); }
public int Eval(IDictionaryy <string, int> dict) { return(cnst); }
public int Eval(IDictionaryy <string, int> dict) { return(dict.Get(var)); }