-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathastprogram.cpp
50 lines (43 loc) · 978 Bytes
/
astprogram.cpp
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
#include "astprogram.h"
extern symboltable symtab;
extern memallocator alloc;
extern typelibrary typelib;
void program::debug(int ind)
{
cout << indent(ind) << string("program") << endl;
defs.debug(ind + 1);
}
void program::semanticCheck()
{
for (defs.begin() ; !defs.atEnd() ; defs.gotoNext()) {
unit* u = defs.getCurrent();
u->semanticCheck();
}
}
void program::createTypes()
{
for (defs.begin() ; !defs.atEnd() ; defs.gotoNext()) {
unit* u = defs.getCurrent();
u->createTypes();
}
}
void program::generateCode()
{
for (defs.begin() ; !defs.atEnd() ; defs.gotoNext()) {
unit* u = defs.getCurrent();
operation* unused;
u->generateCode(unused);
}
/*
registerid generateCode(operation* &p);
alloc.reset();
symtab.resetScope();
unit* u = defs.getCurrent();
operation* z;
u->generateCode(z);
type* gtype = typelib.getTypeByName("##global");
method* m = new method(u->getName(), z, 0, vector<type*>());
gtype->addMethod(m);
}
*/
}