diff options
author | Yann Herklotz <ymherklotz@gmail.com> | 2017-03-06 17:37:51 +0000 |
---|---|---|
committer | Yann Herklotz <ymherklotz@gmail.com> | 2017-03-06 17:37:51 +0000 |
commit | fdd6ff07cee824078c5315bf07926ee15bbdde85 (patch) | |
tree | 25ae7097f5f1ee88b7e9d0f27297f38c08a29009 /c_compiler/include/type.hpp | |
parent | 3cef694323c53a19c8c7c0fab19432eb74f8792a (diff) | |
download | Compiler-fdd6ff07cee824078c5315bf07926ee15bbdde85.tar.gz Compiler-fdd6ff07cee824078c5315bf07926ee15bbdde85.zip |
making changes to type in lexer now
Diffstat (limited to 'c_compiler/include/type.hpp')
-rw-r--r-- | c_compiler/include/type.hpp | 61 |
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; }; |