summaryrefslogtreecommitdiff
path: root/tiger-compiler/src/ast/dec.hh
diff options
context:
space:
mode:
Diffstat (limited to 'tiger-compiler/src/ast/dec.hh')
-rw-r--r--tiger-compiler/src/ast/dec.hh50
1 files changed, 50 insertions, 0 deletions
diff --git a/tiger-compiler/src/ast/dec.hh b/tiger-compiler/src/ast/dec.hh
new file mode 100644
index 0000000..f61489e
--- /dev/null
+++ b/tiger-compiler/src/ast/dec.hh
@@ -0,0 +1,50 @@
+/**
+ ** \file ast/dec.hh
+ ** \brief Declaration of ast::Dec.
+ */
+
+#pragma once
+
+#include <ast/ast.hh>
+#include <ast/typable.hh>
+#include <misc/symbol.hh>
+
+namespace ast
+{
+ /// Dec.
+ class Dec
+ : public Ast
+ , public Typable
+ {
+ public:
+ /** \name Ctor & dtor.
+ ** \{ */
+ /// Construct a Dec node.
+ Dec(const Location& location, misc::symbol name);
+ Dec(const Dec&) = delete;
+ Dec& operator=(const Dec&) = delete;
+ /// Destroy a Dec node.
+ /** \} */
+
+ /// \name Visitors entry point.
+ /// \{ */
+ /// Accept a const visitor \a v.
+ void accept(ConstVisitor& v) const override = 0;
+ /// Accept a non-const visitor \a v.
+ void accept(Visitor& v) override = 0;
+ /// \}
+
+ /** \name Accessors.
+ ** \{ */
+ /// Return name of the defined entity.
+ misc::symbol name_get() const;
+ /// Set name of the defined entity.
+ void name_set(misc::symbol);
+ /** \} */
+
+ protected:
+ /// Name of the defined entity.
+ misc::symbol name_;
+ };
+} // namespace ast
+#include <ast/dec.hxx>