diff options
Diffstat (limited to 'main.cpp')
-rw-r--r-- | main.cpp | 24 |
1 files changed, 16 insertions, 8 deletions
@@ -6,6 +6,7 @@ #include "include/parser.hpp" #include "include/expressions.hpp" #include "include/exceptions.hpp" +#include "include/differentiator.hpp" using std::string, std::cin, std::cout, std::getline, std::vector, std::begin, std::end, std::endl; @@ -13,16 +14,23 @@ using std::string, std::cin, std::cout, std::getline, std::vector, int main(){ string input; Parser parser; - + Expression *tree; + Expression *differential = NULL; getline(cin, input); - //try { - Expression *tree = parser.parse(input); - cout << tree->getRepr() << endl; - //} catch(const ParserException &e) { - //cout << e.showMsg() << endl; - //} - delete tree; + try { + tree = parser.parse(input); + cout << tree->getRepr() << '\n'; + } catch(const ParserException &e) { + cout << e.showMsg() << endl; + tree = NULL; + } + + if(tree != NULL) { + differential = deriv(tree); + delete tree; + delete differential; + } return 0; } |