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 --- .../src/desugar/bounds-checking-visitor.hh | 46 ++++++++++++++++++++++ 1 file changed, 46 insertions(+) create mode 100644 tiger-compiler/src/desugar/bounds-checking-visitor.hh (limited to 'tiger-compiler/src/desugar/bounds-checking-visitor.hh') diff --git a/tiger-compiler/src/desugar/bounds-checking-visitor.hh b/tiger-compiler/src/desugar/bounds-checking-visitor.hh new file mode 100644 index 0000000..65e955d --- /dev/null +++ b/tiger-compiler/src/desugar/bounds-checking-visitor.hh @@ -0,0 +1,46 @@ +/** + ** \file desugar/bounds-checking-visitor.hh + ** \brief Declaration of desugar::BoundsCheckingVisitor. + */ + +#pragma once + +#include + +#include +#include + +namespace desugar +{ + /// \brief Add dynamic array bounds checks while duplicating an AST. + class BoundsCheckingVisitor : public astclone::Cloner + { + public: + /// Parent type. + using super_type = astclone::Cloner; + + // Import overloaded virtual functions. + using super_type::operator(); + + /// Build a BoundsCheckingVisitor. + BoundsCheckingVisitor(); + + /// \name Visit methods. + /// \{ + // FIXME: Some code was deleted here. + /// \} + + private: + /// The bounds checking runtime. + /// + /// Additional definitions to insert in the prelude. + static const std::string prelude; + + // Symbols would be nicer, but maps of symbols are + // inconvenient since there is no default ctor. + using boxes_type = std::map; + /// Map from an array type to the corresponding `box' type name. + boxes_type boxes_; + }; + +} // namespace desugar -- cgit v1.2.3