aboutsummaryrefslogtreecommitdiffstats
path: root/c_compiler/include/function.hpp
blob: dc8640e32c2d1bb062d305f933450769f159462e (plain)
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
#ifndef AST_FUNCTION_HPP
#define AST_FUNCTION_HPP

#include "bindings.hpp"
#include "declaration.hpp"
#include "node.hpp"
#include "statement.hpp"
#include "type.hpp"

#include <memory>
#include <string>

class Declaration;
class Statement;
class Type;
class Function;

typedef std::shared_ptr<Declaration> DeclarationPtr;
typedef std::shared_ptr<Statement> StatementPtr;
typedef std::shared_ptr<Type> TypePtr;
typedef std::shared_ptr<Function> FunctionPtr;


class Function : public Node {
protected:
    TypePtr type_;
    std::string id_;
    DeclarationPtr parameter_list_;
    StatementPtr statement_;
    
public:
    Function(const std::string& id, Declaration* parameter_list, Statement* statement);

    virtual void print() const;
    virtual void printXml() const;
    virtual VariableStackBindings printAsm(VariableStackBindings bindings) const;
};


#endif