-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathast_etc.h
61 lines (49 loc) · 1.55 KB
/
ast_etc.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
49
50
51
52
53
54
55
56
57
58
59
60
61
#pragma once
#include <string>
#include <vector>
#include <map>
#include <list>
#include "utility.h"
#include "parser.h"
#include "lexer.h"
#include "vm.h"
#include "color_text.h"
#include "basic_object.h"
#include <memory>
using namespace std;
class EnvItem{
public:
pair<string,shared_ptr<TypeAST> > VariableInfo;
int LocalIndex;
};
class Environment{
public:
vector< EnvItem > Items;
bool is_internalblock; //関数内部のブロック(if,whileなど)か?
shared_ptr<vector< pair<string,shared_ptr<TypeAST> > > > LocalVariablesPtr;
};
class BlockAST{
public:
shared_ptr<vector<shared_ptr<StatementAST> > > Body;
BlockAST(shared_ptr<vector<shared_ptr<StatementAST> > > body):Body(body){}
void Codegen(shared_ptr<vector<int> > bytecodes,shared_ptr<CodegenInfo> geninfo);
void CheckType(shared_ptr<vector<Environment> > env,shared_ptr<CodegenInfo> geninfo,bool isinternalblock,shared_ptr<vector< pair<string,shared_ptr<TypeAST> > > > CurrentLocalVars);
vector<int> FindChildFunction();
bool IsCTFEable(shared_ptr<CodegenInfo> cgi,int);
vector<shared_ptr<ExprAST> > GetCallExprList();
};
class DataDefAST{
public:
string Name;
vector< pair<string,shared_ptr<TypeAST> > > MemberList;
DataDefAST(){}
DataDefAST(vector< pair<string,shared_ptr<TypeAST> > > member):MemberList(member){}
};
class GroupDefAST{
public:
string Name;
string TargetName; //括弧の中の名前
vector< pair<string,shared_ptr<TypeAST> > > MemberList;
GroupDefAST(){}
GroupDefAST(vector< pair<string,shared_ptr<TypeAST> > > member):MemberList(member){}
};