-
Notifications
You must be signed in to change notification settings - Fork 5
Expand file tree
/
Copy pathFunctions.hpp
More file actions
41 lines (29 loc) · 908 Bytes
/
Functions.hpp
File metadata and controls
41 lines (29 loc) · 908 Bytes
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
#ifndef EXPRINTER_FUNCTIONS_HPP
#define EXPRINTER_FUNCTIONS_HPP
#include <vector>
#include "SymTab.hpp"
#include "Statements.hpp"
class Function {
public:
Function();
Function(std::string name, std::vector<std::string> args, Statements *body)
: _name{name}, _args{args}, _body{body} {}
std::string &name() { return _name; }
std::vector<std::string> &args() { return _args; }
Statements *&body() {return _body; }
private:
std::string _name;
std::vector<std::string> _args;
Statements *_body;
};
// Functions is a collection of Function.
class Functions {
public:
Functions() : _functions{std::vector<Function *>()} {}
std::vector<Function*> &functions() {return _functions; }
void addFunction(Function *func);
Function *findFunction(std::string name);
private:
std::vector<Function *> _functions;
};
#endif //EXPRINTER_FUNCTIONS_HPP