예제 #1
0
 public PrgState(IMyDict <string, int> dict, IMyStack <IStatement> stack, IMyList <int> outList, FileTable <int, FileData> fileTable)
 {
     this.dict      = dict;
     this.stack     = stack;
     this.outList   = outList;
     this.fileTable = fileTable;
 }
        public int Eval(IMyDict <string, int> dict)
        {
            int vst = st.Eval(dict);
            int vdr = dr.Eval(dict);

            if (op == '+')
            {
                return(vst + vdr);
            }
            if (op == '-')
            {
                return(vst - vdr);
            }
            if (op == '*')
            {
                return(vst * vdr);
            }
            else
            {
                if (vdr == 0)
                {
                    throw new DivideByZeroException();
                }
                else
                {
                    return(vst / vdr);
                }
            }
        }
예제 #3
0
 public int Eval(IMyDict <string, int> dict)
 {
     return(dict.GetValue(id));
 }
예제 #4
0
 public int Eval(IMyDict <string, int> dict)
 {
     return(number);
 }