aboutsummaryrefslogtreecommitdiff
path: root/src/tree.h
blob: 858d7373350d65506254dfce9db1545145ef1cc9 (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
#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* addOperand(Node**, std::string);
		Node* addOperator(Node**, TokenType);
		Node* buildTree(std::string);

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

}

#endif  // PARSER_SRC_NODE_H_