From 967be9e750221ab2ab783f95df79bb26d290a45e Mon Sep 17 00:00:00 2001 From: Martial Simon Date: Mon, 15 Sep 2025 01:07:58 +0200 Subject: add: added projects --- tiger-compiler/src/ast/typable.hh | 50 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 50 insertions(+) create mode 100644 tiger-compiler/src/ast/typable.hh (limited to 'tiger-compiler/src/ast/typable.hh') diff --git a/tiger-compiler/src/ast/typable.hh b/tiger-compiler/src/ast/typable.hh new file mode 100644 index 0000000..50c004e --- /dev/null +++ b/tiger-compiler/src/ast/typable.hh @@ -0,0 +1,50 @@ +/** + ** \file ast/typable.hh + ** \brief Declaration of ast::Typable. + */ + +#pragma once + +#include +#include + +namespace ast +{ + /** \class ast::Typable + ** \brief Hold a type information. + ** + ** A Typable node holds a type information (type::Type) about + ** this node. This can be: + ** \li the type of the node itself, if it is a Exp or a Ty, or + ** \li the type of of the declared object, in case of a Dec. + */ + + class Typable + { + // FIXME DONE: Some code was deleted here. + + public: + // Only need for basic constructor and destructor here + Typable(); + virtual ~Typable() = default; + + /* We prohibit copy and assignment as to avoid having + ** multiple Typable referencing the same Type which could + ** potentially mess up the TypeConstructor + */ + Typable(const Typable&) = delete; + Typable& operator=(const Typable&) = delete; + + // Basic getters/setters + void type_set(const type::Type*); + const type::Type* type_get() const; + + // Making sure we can visit thoses "nodes" + virtual void accept(ConstVisitor& v) const = 0; + virtual void accept(Visitor& v) = 0; + + private: + const type::Type* type_; + }; +} // namespace ast +#include -- cgit v1.2.3