2014-01-31 08:23:00 +13:00
|
|
|
|
|
|
|
|
/*
|
|
|
|
|
|
|
|
|
|
An environ represent a stack frame block.
|
|
|
|
|
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
#ifndef ENVIRON_H
|
|
|
|
|
#define ENVIRON_H
|
|
|
|
|
|
2019-01-18 15:55:51 +01:00
|
|
|
#include "decl.hpp"
|
|
|
|
|
#include "label.hpp"
|
2019-01-18 17:04:57 +01:00
|
|
|
#include "type.hpp"
|
2014-01-31 08:23:00 +13:00
|
|
|
|
2019-01-18 17:04:57 +01:00
|
|
|
class Environ {
|
|
|
|
|
public:
|
|
|
|
|
int level;
|
|
|
|
|
DeclSeq* decls;
|
|
|
|
|
DeclSeq* funcDecls;
|
|
|
|
|
DeclSeq* typeDecls;
|
2014-01-31 08:23:00 +13:00
|
|
|
|
|
|
|
|
vector<Type*> types;
|
|
|
|
|
|
|
|
|
|
vector<Label*> labels;
|
2019-01-18 17:04:57 +01:00
|
|
|
Environ* globals;
|
|
|
|
|
Type* returnType;
|
|
|
|
|
string funcLabel, breakLabel;
|
|
|
|
|
list<Environ*> children; //for delete!
|
2014-01-31 08:23:00 +13:00
|
|
|
|
2019-01-18 17:04:57 +01:00
|
|
|
Environ(const string& f, Type* r, int l, Environ* gs);
|
2014-01-31 08:23:00 +13:00
|
|
|
~Environ();
|
|
|
|
|
|
2019-01-18 17:04:57 +01:00
|
|
|
Decl* findDecl(const string& s);
|
|
|
|
|
Decl* findFunc(const string& s);
|
|
|
|
|
Type* findType(const string& s);
|
|
|
|
|
Label* findLabel(const string& s);
|
|
|
|
|
Label* insertLabel(const string& s, int def, int src, int sz);
|
2014-01-31 08:23:00 +13:00
|
|
|
|
2019-01-18 17:04:57 +01:00
|
|
|
string setBreak(const string& s);
|
2014-01-31 08:23:00 +13:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
#endif
|