-
Notifications
You must be signed in to change notification settings - Fork 0
/
ASTBinaryNode.h
49 lines (40 loc) · 1.18 KB
/
ASTBinaryNode.h
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
/*
* File: ASTBinaryNode.h
* Author: claire
*
* Created on October 6, 2013, 2:47 PM
*/
#ifndef ASTBINARYNODE_H
#define ASTBINARYNODE_H
#include "ASTExpressionNode.h"
class ASTLiteralNode;
/*The ASTBinaryNode represents binary operations within the code, such as
* multiplication, addition, subtraction, division. It is a subclass of
* ASTExpressionNode. It contains an override of the
* print statement. It has pointers to the left and right side of the operation,
* which are expressions. It also has the type of operation as an int representing
* and ENUM.
*/
class ASTBinaryNode : public ASTExpressionNode {
public:
ASTBinaryNode();
ASTBinaryNode(const ASTBinaryNode& orig);
ASTBinaryNode& operator= (const ASTBinaryNode &rhs);
virtual ~ASTBinaryNode();
void semAnalyze();
void semAnalyze(bool restrictIdents);
void scopeAnalyze();
void typeAnalyze();
string genQuadruples();
string genAndThenSS();
string genOrElseSS();
ASTLiteralNode * calc();
void printNode(int indent, ostream * output);
int oper;
ASTExpressionNode * left, *right;
private:
bool isArithmeticOper();
bool isLogicOper();
bool isRelationalOper();
};
#endif /* ASTBINARYNODE_H */