-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathArithmeticExpressionNode.hpp
50 lines (37 loc) · 1.39 KB
/
ArithmeticExpressionNode.hpp
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
37
38
39
40
41
42
43
44
45
46
47
48
49
50
#ifndef ARITHMETIC_EXPRESSION_NODE_H
#define ARITHMETIC_EXPRESSION_NODE_H
#include "Node.h"
class ArithmeticExpressionNode : public Node {
protected:
Node *left, *right;
public:
ArithmeticExpressionNode(const std::string &t, Node *left, Node *right,
int l)
: Node(t, l, {left, right}), left{left}, right{right} {};
std::string checkTypes(SymbolTable &st) const override;
};
class PlusNode : public ArithmeticExpressionNode {
public:
PlusNode(Node *left, Node *right, int l)
: ArithmeticExpressionNode("Plus", left, right, l){};
Operand generateIR(CFG &graph, SymbolTable &st) override;
};
class MinusNode : public ArithmeticExpressionNode {
public:
MinusNode(Node *left, Node *right, int l)
: ArithmeticExpressionNode("Minus", left, right, l){};
Operand generateIR(CFG &graph, SymbolTable &st) override;
};
class MultiplicationNode : public ArithmeticExpressionNode {
public:
MultiplicationNode(Node *left, Node *right, int l)
: ArithmeticExpressionNode("Multiplication", left, right, l){};
Operand generateIR(CFG &graph, SymbolTable &st) override;
};
class DivisionNode : public ArithmeticExpressionNode {
public:
DivisionNode(Node *left, Node *right, int l)
: ArithmeticExpressionNode("Division", left, right, l){};
Operand generateIR(CFG &graph, SymbolTable &st) override;
};
#endif