35 std::cerr <<
"need a filename as argument\n";
43 if (!
line.size() ||
line.at(0) ==
';')
continue;
45 string::size_type start =
line.find_first_of(
'"');
47 string::size_type end =
line.find_last_of(
'"');
50 std::cout <<
left <<
"\n";
51 std::istringstream
iss(
string(
line, end + 1), std::istringstream::in);
54 std::cout <<
"exprStr: " <<
exprStr << std::endl;
55 std::cout <<
"dim: " << dim << std::endl;
58 if (!
expr.isValid()) {
59 std::cerr <<
expr.parseError() << std::endl;
65 for (
int i = 0;
i < dim; ++
i) std::cout <<
result[
i] <<
' ';
66 std::cout << std::endl;
69 if (!
argv[2])
return 0;
75 if (!
line.size() ||
line.at(0) ==
';')
continue;
77 std::cout <<
"exprStr: " <<
line << std::endl;
79 if (!
expr.isValid()) {
80 std::cerr <<
expr.parseError() << std::endl;
llvmexpr(const std::string &expr, const ExprType &type=ExprType().FP(3))
Constructor that takes the expression to parse.
int main(int argc, char *argv[])
</pre >< h3 > Binding our variable reference</h3 > If we now tried to use the variable would still not be found by our expressions To make it bindable we need to override the resolveVar() function as follows</pre >< h3 > Variable setting</h3 > Next we need to make a way of setting the variable As the controlling code will use the expression it will repeatedly alternate between setting the independent variables that are used and calling evaluate(). What it has to do depends very much on the application. In this case we only need to set the independent variable x as</pre >< h2 > Evaluating expressions</h2 > Evaluating an expression is pretty easy But before we can do that we need to make an instance< pre > GrapherExpr expr("x+x^2")