aboutsummaryrefslogtreecommitdiffstats
path: root/c_compiler/include/type.hpp
diff options
context:
space:
mode:
Diffstat (limited to 'c_compiler/include/type.hpp')
-rw-r--r--c_compiler/include/type.hpp61
1 files changed, 57 insertions, 4 deletions
diff --git a/c_compiler/include/type.hpp b/c_compiler/include/type.hpp
index 6e8eefa..415f00f 100644
--- a/c_compiler/include/type.hpp
+++ b/c_compiler/include/type.hpp
@@ -6,11 +6,64 @@
class Type : public Node {
public:
- Type();
+ virtual void print() const;
+ virtual void printxml() const;
+ virtual void printasm() const;
- virtual void print() const {}
- virtual void printxml() const {}
- virtual void printasm() const {}
+ virtual std::string getType() const = 0;
+};
+
+
+class Specifier : Type {
+public:
+ virtual std::string getType() const = 0;
+};
+
+
+class Pointer : Type {
+protected:
+ Type* pointer_type;
+
+public:
+ Pointer(Type* _pointer_type);
+
+ virtual std::string getType() const;
+};
+
+
+class Array : Type {
+protected:
+ int32_t size;
+ Type* array_type;
+
+public:
+ Array(Type* _array_type, int32_t _size = 0);
+
+ virtual std::string getType() const;
+};
+
+
+class Void : Specifier {
+public:
+ Void();
+
+ virtual std::string getType() const;
+};
+
+
+class Int : Specifier {
+public:
+ Int();
+
+ virtual std::string getType() const;
+};
+
+
+class Char : Specifier {
+public:
+ Char();
+
+ virtual std::string getType() const;
};