aboutsummaryrefslogtreecommitdiff
path: root/include/ast_node.hpp
diff options
context:
space:
mode:
Diffstat (limited to 'include/ast_node.hpp')
-rw-r--r--include/ast_node.hpp36
1 files changed, 36 insertions, 0 deletions
diff --git a/include/ast_node.hpp b/include/ast_node.hpp
new file mode 100644
index 0000000..caffb35
--- /dev/null
+++ b/include/ast_node.hpp
@@ -0,0 +1,36 @@
+#pragma once
+
+#include "node_type.hpp"
+#include "type.hpp"
+
+#include <string>
+#include <vector>
+#include <memory>
+
+class ASTNode {
+public:
+ int line;
+ int column;
+
+ virtual ~ASTNode() = default;
+};
+
+class ProgramNode : ASTNode {
+public:
+ std::vector<ASTNode> function_declarations;
+
+ explicit ProgramNode(std::vector<ASTNode> f) : function_declarations(f) { }
+};
+
+class FunctionDeclNode : ASTNode {
+ Type type;
+ std::vector<ParameterNode> parameters;
+ std::vector<ASTNode> body;
+
+ FunctionDeclNode(std::string t,std::vector<ASTNode> p, std::vector<ASTNode> b) : type(t), parameters(p), body(b) { }
+};
+
+class ParameterNode : ASTNode {
+ std::string name;
+ std::string type;
+};