/// <summary> /// The method evaluates (executes) a program, which is represented as a syntax tree of nodes. /// An input parameters could be integer arrays or integer values (represented as an array with single value). /// </summary> /// <param name="program">A program is represented as an AST</param> /// <param name="inputStream">Program's input data</param> /// <returns>An evaluated array of some data</returns> public int[] Eval(IASTNode program, IInputStream inputStream) { if (program == null) { throw new ArgumentNullException("program", "The argument cannot equal to null"); } if (inputStream == null) { throw new ArgumentNullException("inputData", "The argument cannot equal to null"); } mInputStream = inputStream; mEnvironment.Clear(); return((int[])program.Accept(this)); }