#include #include #include #include #include #include #include int main(int argc, char *argv[]) { std::cout << "Expression Simplifier example program (i1)" << std::endl; try { std::string exprStr(argc == 2 ? argv[1] : "x^x"); std::auto_ptr >expr(math::TReader::parse(exprStr)); std::cout << "original : " << math::TPrinter::print(expr.get()) << std::endl; std::auto_ptr >de(math::TDeriver::derive(expr.get())); std::cout << "derivation : " << math::TPrinter::print(de.get()) << std::endl; std::auto_ptr >sde(math::TSimplifier::simplify(de.get())); std::cout << "simplified : " << math::TPrinter::print(sde.get()) << std::endl; } catch (const math::EMath& e) { std::cout << "exception caught: " << e.reason() << std::endl; return 1; } catch (...) { std::cout << "further exception caught." << std::endl; return 1; } return 0; }