aboutsummaryrefslogtreecommitdiffstats
path: root/c_compiler/include/declaration.hpp
blob: 5780bd9c84939e66fe94d08e6086f317225879d3 (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
#ifndef AST_DECLARATION_HPP
#define AST_DECLARATION_HPP

#include "node.hpp"

class Expression;


class Declaration : public Node {
private:
    Type* type;
    std::string id;
    Expression* init;
    Declaration* next_decl;
    Declaration* list_next_decl;
    
public:
    Declaration(const std::string& _id = "", Expression* _init = nullptr);

    virtual void print() const;
    virtual void printxml() const;
    virtual VariableStackBindings printasm(VariableStackBindings bindings) const;

    void addDeclaration(Declaration* _next_decl);
    void addList(Declaration* _next_decl);

    void setType(Type* _type);

    Declaration* getNext() const;
    Declaration* getNextListItem() const;
    std::string getId() const;
    std::string getType() const;
};

#endif