diff options
Diffstat (limited to 'c_compiler/include/type.hpp')
-rw-r--r-- | c_compiler/include/type.hpp | 70 |
1 files changed, 70 insertions, 0 deletions
diff --git a/c_compiler/include/type.hpp b/c_compiler/include/type.hpp new file mode 100644 index 0000000..3deca58 --- /dev/null +++ b/c_compiler/include/type.hpp @@ -0,0 +1,70 @@ +#ifndef TYPE_HPP +#define TYPE_HPP + +#include "node.hpp" + + +class Type : public Node { +public: + virtual void print() const; + virtual void printxml() const; + virtual VariableStackBindings printasm(VariableStackBindings bindings) const; + + virtual std::string getType() const = 0; +}; + + +class Specifier : public Type { +public: + virtual std::string getType() const = 0; +}; + + +class Pointer : public Type { +protected: + Type* pointer_type; + +public: + Pointer(Type* _pointer_type); + + virtual std::string getType() const; +}; + + +class Array : public Type { +protected: + int32_t size; + Type* array_type; + +public: + Array(Type* _array_type, int32_t _size = 0); + + virtual std::string getType() const; +}; + + +class Void : public Specifier { +public: + Void(); + + virtual std::string getType() const; +}; + + +class Int : public Specifier { +public: + Int(); + + virtual std::string getType() const; +}; + + +class Char : public Specifier { +public: + Char(); + + virtual std::string getType() const; +}; + + +#endif |