diff options
Diffstat (limited to 'ast')
-rw-r--r-- | ast/ast.cpp | 37 | ||||
-rw-r--r-- | ast/ast.hpp | 36 |
2 files changed, 72 insertions, 1 deletions
diff --git a/ast/ast.cpp b/ast/ast.cpp new file mode 100644 index 00000000..5c9c566e --- /dev/null +++ b/ast/ast.cpp @@ -0,0 +1,37 @@ +/*
+ */
+#include "ast.hpp"
+#include "../types.hpp"
+#include <iostream>
+
+namespace AST {
+
+void Module::add_constant(bool is_public, ::std::string name, TypeRef type, Expr val)
+{
+ ::std::cout << "add_constant()" << ::std::endl;
+}
+
+void Module::add_global(bool is_public, bool is_mut, ::std::string name, TypeRef type, Expr val)
+{
+ ::std::cout << "add_global()" << ::std::endl;
+}
+
+ExprNode::ExprNode(TagInteger, uint64_t value, enum eCoreType datatype)
+{
+
+}
+
+TypeParam::TypeParam(bool is_lifetime, ::std::string name)
+{
+
+}
+void TypeParam::addLifetimeBound(::std::string name)
+{
+
+}
+void TypeParam::addTypeBound(TypeRef type)
+{
+
+}
+
+}
diff --git a/ast/ast.hpp b/ast/ast.hpp index f637e742..f84f322f 100644 --- a/ast/ast.hpp +++ b/ast/ast.hpp @@ -1,6 +1,12 @@ #ifndef AST_HPP_INCLUDED
#define AST_HPP_INCLUDED
+#include <string>
+#include <vector>
+#include "../coretypes.hpp"
+
+class TypeRef;
+
namespace AST {
class Path
@@ -9,10 +15,38 @@ public: void append(::std::string str) {}
};
+class ExprNode
+{
+public:
+ struct TagAssign {};
+ ExprNode(TagAssign, ExprNode slot, ExprNode value) {}
+ struct TagInteger {};
+
+ ExprNode(TagInteger, uint64_t value, enum eCoreType datatype);
+};
+
+class Expr
+{
+public:
+ Expr(ExprNode node) {}
+};
+
+class TypeParam
+{
+public:
+ TypeParam(bool is_lifetime, ::std::string name);
+ void addLifetimeBound(::std::string name);
+ void addTypeBound(TypeRef type);
+};
+
+typedef ::std::vector<TypeParam> TypeParams;
+
class Module
{
public:
- void add_alias(Path path) {}
+ void add_alias(bool is_public, Path path) {}
+ void add_constant(bool is_public, ::std::string name, TypeRef type, Expr val);
+ void add_global(bool is_public, bool is_mut, ::std::string name, TypeRef type, Expr val);
};
}
|