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

#include "ast.hpp"

// Declaration that holds a list of declarations

class Declaration : public Node {
protected:
    Type* type;
    std::string id;
    Initializer* init;
    Declaration* next_decl;
    Declaration* list_next_decl;
    
public:
    Declaration(const std::string& _id = "");

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

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

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

#endif