blob: fb8b8dfc4c1efdc7015dfef8f5e62e585574196b (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
|
#include <iterator>
#include <ostream>
#include <string>
#include <vector>
#include <iostream>
#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;
int main(){
string input;
Parser parser;
Expression *tree;
Expression *differential = NULL;
getline(cin, input);
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;
}
|