aboutsummaryrefslogtreecommitdiffstats
path: root/c_parser/include
diff options
context:
space:
mode:
Diffstat (limited to 'c_parser/include')
-rw-r--r--c_parser/include/ast.hpp3
-rw-r--r--c_parser/include/ast_declaration.hpp17
-rw-r--r--c_parser/include/ast_declaration.hpp~11
-rw-r--r--c_parser/include/ast_expression.hpp14
-rw-r--r--c_parser/include/ast_expression.hpp~11
5 files changed, 56 insertions, 0 deletions
diff --git a/c_parser/include/ast.hpp b/c_parser/include/ast.hpp
index 05ed1e4..834ad44 100644
--- a/c_parser/include/ast.hpp
+++ b/c_parser/include/ast.hpp
@@ -1,6 +1,9 @@
#ifndef AST_HPP
#define AST_HPP
+#include "ast_expression.hpp"
+#include "ast_declaration.hpp"
+extern const Expression *parseAST();
#endif
diff --git a/c_parser/include/ast_declaration.hpp b/c_parser/include/ast_declaration.hpp
new file mode 100644
index 0000000..cce68b6
--- /dev/null
+++ b/c_parser/include/ast_declaration.hpp
@@ -0,0 +1,17 @@
+#ifndef AST_DECLARATION_HPP
+#define AST_DECLARATION_HPP
+
+#include "ast.hpp"
+
+class Declaration : public Expression {
+private:
+ const std::string id;
+public:
+ Declaration(const std::string& _id) : id(_id) {}
+
+ virtual void print() const override {
+ std::cout << id;
+ }
+};
+
+#endif
diff --git a/c_parser/include/ast_declaration.hpp~ b/c_parser/include/ast_declaration.hpp~
new file mode 100644
index 0000000..ba786fc
--- /dev/null
+++ b/c_parser/include/ast_declaration.hpp~
@@ -0,0 +1,11 @@
+#ifndef AST_DECLARATION_HPP
+#define AST_DECLARATION_HPP
+
+#include "ast.hpp"
+
+class Declaration : public Expression {
+private:
+ const
+};
+
+#endif
diff --git a/c_parser/include/ast_expression.hpp b/c_parser/include/ast_expression.hpp
new file mode 100644
index 0000000..493781e
--- /dev/null
+++ b/c_parser/include/ast_expression.hpp
@@ -0,0 +1,14 @@
+#ifndef AST_EXPRESSION_HPP
+#define AST_EXPRESSION_HPP
+
+#include <string>
+#include <iostream>
+
+class Expression {
+public:
+ virtual ~Expression() {}
+
+ virtual void print() const = 0;
+};
+
+#endif
diff --git a/c_parser/include/ast_expression.hpp~ b/c_parser/include/ast_expression.hpp~
new file mode 100644
index 0000000..7bd9814
--- /dev/null
+++ b/c_parser/include/ast_expression.hpp~
@@ -0,0 +1,11 @@
+#ifndef AST_EXPRESSION_HPP
+#define AST_EXPRESSION_HPP
+
+class Expression {
+public:
+ virtual ~Expression() {}
+
+ virtual void print() const = 0;
+};
+
+#endif