forked from Uyouii/cCompiler
-
Notifications
You must be signed in to change notification settings - Fork 0
/
innerCode.h
37 lines (30 loc) · 797 Bytes
/
innerCode.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
#ifndef _INNERCODE_H_
#define _INNERCODE_H_
#include <iostream>
#include "tree.h"
#include "block.h"
#include "codeOptimize.h"
#include<string>
extern struct gramTree* root;
using namespace std;
class InnerCode {
private:
vector<string> codeList;
public:
int tempNum = 0;
int varNum = 0;
int labelNum = 0;
int arrayNum = 0;
InnerCode();
void addCode(string);
void printCode();
string createCodeforVar(string tempname, string op, varNode node1, varNode node2);
string createCodeforAssign(varNode node1,varNode node2);
string createCodeforParameter(varNode node);
string createCodeforReturn(varNode node);
string createCodeforArgument(varNode node);
string getNodeName(varNode node);
string getarrayNodeName(arrayNode node);
string getLabelName();
};
#endif // !_INNERCODE_H_