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/ast.hh | |
Diffstat (limited to 'tiger-compiler/src/ast/ast.hh')
| -rw-r--r-- | tiger-compiler/src/ast/ast.hh | 48 |
1 files changed, 48 insertions, 0 deletions
diff --git a/tiger-compiler/src/ast/ast.hh b/tiger-compiler/src/ast/ast.hh new file mode 100644 index 0000000..1c3037c --- /dev/null +++ b/tiger-compiler/src/ast/ast.hh @@ -0,0 +1,48 @@ +/** + ** \file ast/ast.hh + ** \brief Declaration of ast::Ast. + */ + +#pragma once + +#include <ast/fwd.hh> +#include <ast/location.hh> + +namespace ast +{ + /// Ast. + class Ast + { + public: + /** \name Ctor & dtor. + ** \{ */ + /// Construct an Ast node. + explicit Ast(const Location& location); + Ast(const Ast&) = delete; + Ast& operator=(const Ast&) = delete; + /// Destroy an Ast node. + virtual ~Ast() = default; + /** \} */ + + /// \name Visitors entry point. + /// \{ */ + /// Accept a const visitor \a v. + virtual void accept(ConstVisitor& v) const = 0; + /// Accept a non-const visitor \a v. + virtual void accept(Visitor& v) = 0; + /// \} + + /** \name Accessors. + ** \{ */ + /// Return scanner position information. + const Location& location_get() const; + /// Set scanner position information. + void location_set(const Location&); + /** \} */ + + protected: + /// Scanner position information. + Location location_; + }; +} // namespace ast +#include <ast/ast.hxx> |
