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/desugar/desugar-visitor.hh | |
Diffstat (limited to 'tiger-compiler/src/desugar/desugar-visitor.hh')
| -rw-r--r-- | tiger-compiler/src/desugar/desugar-visitor.hh | 42 |
1 files changed, 42 insertions, 0 deletions
diff --git a/tiger-compiler/src/desugar/desugar-visitor.hh b/tiger-compiler/src/desugar/desugar-visitor.hh new file mode 100644 index 0000000..c6eee69 --- /dev/null +++ b/tiger-compiler/src/desugar/desugar-visitor.hh @@ -0,0 +1,42 @@ +/** + ** \file desugar/desugar-visitor.hh + ** \brief Declaration of desugar::DesugarVisitor. + */ + +#pragma once + +#include <map> + +#include <astclone/cloner.hh> + +namespace desugar +{ + /// \brief Desugar some syntactic structures while duplicating an Ast. + class DesugarVisitor : public astclone::Cloner + { + public: + /// Superclass. + using super_type = astclone::Cloner; + + // Import overloaded virtual functions. + using super_type::operator(); + + /// Build a DesugarVisitor. + DesugarVisitor(bool desugar_for_p, bool desugar_string_cmp_p); + + /// \name Visit methods. + /// \{ + /// Desugar string comparisons. + void operator()(const ast::OpExp&) override; + /// Desugar `for' loops as `while' loops. + void operator()(const ast::ForExp&) override; + /// \} + + private: + /// Desugar `for' loops? + bool desugar_for_p_; + /// Desugar string comparisons? + bool desugar_string_cmp_p_; + }; + +} // namespace desugar |
