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/non-object-visitor.hh | 92 ++++++++++++++++++++++++++++ 1 file changed, 92 insertions(+) create mode 100644 tiger-compiler/src/ast/non-object-visitor.hh (limited to 'tiger-compiler/src/ast/non-object-visitor.hh') diff --git a/tiger-compiler/src/ast/non-object-visitor.hh b/tiger-compiler/src/ast/non-object-visitor.hh new file mode 100644 index 0000000..c3fcf1a --- /dev/null +++ b/tiger-compiler/src/ast/non-object-visitor.hh @@ -0,0 +1,92 @@ +/** + ** \file ast/non-object-visitor.hh + ** \brief Provide aborting visits for object-related nodes. + */ + +#pragma once + +#include + +namespace ast +{ + /** GenNonObjectVisitor provides aborting visit + methods for object-related nodes. This class is meant to factor + the code visiting object-related nodes in visitors bound to + process AST \em without objects. + + ast::GenNonObjectVisitor inherits virtually from ast::GenVisitor + to allow diamond inheritance, notably for a ``compatibility'' + purpose with ast::GenDefaultVisitor. + + For instance, type::TypeChecker, a visitor that checks the types + of an AST without objects, inherits from ast::DefaultVisitor to + factor default (``empty'') traversal implementations, and from + ast::NonObjectVisitor to get an aborting behavior for + object-related nodes. + + \verbatim + + /ast::Visitor/ + ^ + (virtual) | (virtual) + ,--------------+--------------. + | | + | | + /ast::DefaultVisitor/ /ast::NonObjectVisitor/ + ^ ^ + | | + `--------------+--------------' + | + | + type::TypeChecker + + \endverbatim + */ + template