public static Func <double, double> CompileFunction(string functionText) { var ast = ParserInstance.Parse(functionText); var builder = new ExpressionTreeBuilder(); var expression = builder.CreateFunction(ast.Root); var function = expression.Compile(); return(function); }
private static ParseTree Parse(string text, CompileResult result) { ParseTree ast = ParserInstance.Parse(text); var compileErrors = GetCompilerErrors(ast.ParserMessages); if (!compileErrors.IsEmpty()) { result.Errors.AddRange(compileErrors); } return(ast); }