-
Notifications
You must be signed in to change notification settings - Fork 0
/
ASTUnaryNode.h
43 lines (33 loc) · 975 Bytes
/
ASTUnaryNode.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
/*
* File: ASTUnaryNode.h
* Author: claire
*
* Created on October 6, 2013, 2:47 PM
*/
#ifndef ASTUNARYNODE_H
#define ASTUNARYNODE_H
#include "ASTExpressionNode.h"
/*ASTUnaryNode represents unary operations such as mod, and "-". It is a subclass
* of ASTExpressionNode, and overrides the print method. It contains:
* -a type(int or bool) (eg. -4 is type int)
* -operation as an ENUM (not, minus,etc)
* - a pointer to the operand
*/
class ASTUnaryNode : public ASTExpressionNode{
public:
ASTUnaryNode();
ASTUnaryNode(const ASTUnaryNode& orig);
ASTUnaryNode& operator= (const ASTUnaryNode &rhs);
virtual ~ASTUnaryNode();
void semAnalyze();
void semAnalyze(bool restrictIdents);
void scopeAnalyze();
void typeAnalyze();
string genQuadruples();
ASTLiteralNode * calc();
void printNode(int indent, ostream * output);
int operation;
ASTExpressionNode * operand;
private:
};
#endif /* ASTUNARYNODE_H */