aboutsummaryrefslogtreecommitdiffstats
path: root/c_compiler/include/declaration.hpp
diff options
context:
space:
mode:
Diffstat (limited to 'c_compiler/include/declaration.hpp')
-rw-r--r--c_compiler/include/declaration.hpp35
1 files changed, 35 insertions, 0 deletions
diff --git a/c_compiler/include/declaration.hpp b/c_compiler/include/declaration.hpp
new file mode 100644
index 0000000..8226090
--- /dev/null
+++ b/c_compiler/include/declaration.hpp
@@ -0,0 +1,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 = "");
+
+ 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