-
Notifications
You must be signed in to change notification settings - Fork 0
/
ASTVariableNode.h
45 lines (37 loc) · 1.1 KB
/
ASTVariableNode.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
/*
* File: ASTVariableNode.h
* Author: daniel
*
* Created on October 8, 2013, 8:51 AM
*/
#ifndef ASTVARIABLENODE_H
#define ASTVARIABLENODE_H
#include "ASTFunctionCallNode.h"
#include "ASTVariableDeclarationNode.h"
/*ASTVariable Node represents variables in the language.
* It is a subclass of ASTExpressionNode.and overrides the print method
* the node contains :
* -the id of the ID (identifier name)
* -if it is an array or not
* -a pointer to the expression denoting where in the array we are looking
* (e.g. x[4], 4 is the expression.)
*/
class ASTVariableNode : public ASTExpressionNode {
public:
ASTVariableNode();
ASTVariableNode(const ASTVariableNode& orig);
ASTVariableNode& operator= (const ASTVariableNode &rhs);
virtual ~ASTVariableNode();
void semAnalyze();
void semAnalyze(bool restrictIdents);
void scopeAnalyze();
void typeAnalyze();
void printNode(int indent, ostream * output);
string genQuadruples();
int id;
ASTVariableDeclarationNode * varDec;
bool isArray;
ASTExpressionNode * arrayExp;
private:
};
#endif /* ASTVARIABLENODE_H */