aboutsummaryrefslogtreecommitdiff
path: root/src/tree.h
blob: 5beec8770c2a5f338fe4ab5598c61341ae61d6a0 (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
#ifndef PARSER_SRC_NODE_H_
#define PARSER_SRC_NODE_H_

#include <vector>
#include <string>
#include <memory>

#include "nodes.h"

namespace SimpleParser {

class Tree {
	public:
		Tree(std::string);

		double solve();
		std::string print();

	private:
		Node* addOperand(Node**, double);
		Node* addOperator(Node**, char);
		Node* buildTree(std::string);

		std::vector<std::unique_ptr<Node>> node_collection_;
		Node* root_node_;
		std::string term_;
};

}

#endif  // PARSER_SRC_NODE_H_