diff options
| author | Martial Simon <msimon_fr@hotmail.com> | 2025-09-15 01:07:58 +0200 |
|---|---|---|
| committer | Martial Simon <msimon_fr@hotmail.com> | 2025-09-15 01:07:58 +0200 |
| commit | 967be9e750221ab2ab783f95df79bb26d290a45e (patch) | |
| tree | 6802900a5e975f9f68b169f0f503f040056d6952 /tiger-compiler/src/ast/array-exp.hh | |
Diffstat (limited to 'tiger-compiler/src/ast/array-exp.hh')
| -rw-r--r-- | tiger-compiler/src/ast/array-exp.hh | 60 |
1 files changed, 60 insertions, 0 deletions
diff --git a/tiger-compiler/src/ast/array-exp.hh b/tiger-compiler/src/ast/array-exp.hh new file mode 100644 index 0000000..ceab385 --- /dev/null +++ b/tiger-compiler/src/ast/array-exp.hh @@ -0,0 +1,60 @@ +/** + ** \file ast/array-exp.hh + ** \brief Declaration of ast::ArrayExp. + */ + +#pragma once + +#include <ast/exp.hh> +#include <ast/name-ty.hh> + +namespace ast +{ + /// ArrayExp. + class ArrayExp : public Exp + { + public: + /** \name Ctor & dtor. + ** \{ */ + /// Construct an ArrayExp node. + ArrayExp(const Location& location, NameTy* type_name, Exp* size, Exp* init); + ArrayExp(const ArrayExp&) = delete; + ArrayExp& operator=(const ArrayExp&) = delete; + /// Destroy an ArrayExp node. + ~ArrayExp() override; + /** \} */ + + /// \name Visitors entry point. + /// \{ */ + /// Accept a const visitor \a v. + void accept(ConstVisitor& v) const override; + /// Accept a non-const visitor \a v. + void accept(Visitor& v) override; + /// \} + + /** \name Accessors. + ** \{ */ + /// Return identifier of the stored elements type. + const NameTy& type_name_get() const; + /// Return identifier of the stored elements type. + NameTy& type_name_get(); + /// Return size of the array. + const Exp& size_get() const; + /// Return size of the array. + Exp& size_get(); + /// Return initial value assigned to all elements of the array. + const Exp& init_get() const; + /// Return initial value assigned to all elements of the array. + Exp& init_get(); + /** \} */ + + protected: + /// Identifier of the stored elements type. + NameTy* type_name_; + /// Size of the array. + Exp* size_; + /// Initial value assigned to all elements of the array. + Exp* init_; + }; +} // namespace ast +#include <ast/array-exp.hxx> |
