aboutsummaryrefslogtreecommitdiff
path: root/asm
diff options
context:
space:
mode:
Diffstat (limited to 'asm')
-rw-r--r--asm/preprocesser.cpp13
-rw-r--r--asm/preprocesser.hpp39
2 files changed, 52 insertions, 0 deletions
diff --git a/asm/preprocesser.cpp b/asm/preprocesser.cpp
new file mode 100644
index 0000000..615cf93
--- /dev/null
+++ b/asm/preprocesser.cpp
@@ -0,0 +1,13 @@
+/* Copyright (C) 2024 Aryadev Chavali
+
+ * You may distribute and modify this code under the terms of the
+ * GPLv2 license. You should have received a copy of the GPLv2
+ * license with this file. If not, please write to:
+ * aryadev@aryadevchavali.com.
+
+ * Created: 2024-04-14
+ * Author: Aryadev Chavali
+ * Description: Preprocessor which occurs after lexing before parsing.
+ */
+
+#include "./preprocesser.hpp"
diff --git a/asm/preprocesser.hpp b/asm/preprocesser.hpp
new file mode 100644
index 0000000..9d733dd
--- /dev/null
+++ b/asm/preprocesser.hpp
@@ -0,0 +1,39 @@
+/* Copyright (C) 2024 Aryadev Chavali
+
+ * You may distribute and modify this code under the terms of the GPLv2
+ * license. You should have received a copy of the GPLv2 license with
+ * this file. If not, please write to: aryadev@aryadevchavali.com.
+
+ * Created: 2024-04-14
+ * Author: Aryadev Chavali
+ * Description: Preprocessor which occurs after lexing before parsing.
+ */
+
+#ifndef PREPROCESSER_HPP
+#define PREPROCESSER_HPP
+
+#include <tuple>
+
+#include "./lexer.hpp"
+
+enum pp_err_t
+{
+ OK = 0,
+ EXPECTED_NAME,
+ EXPECTED_STRING,
+ EXPECTED_END,
+ FILE_NONEXISTENT,
+ FILE_PARSE_ERROR,
+ UNKNOWN_NAME,
+};
+
+std::pair<std::vector<token_t>, pp_err_t>
+preprocesser(const std::vector<token_t> &);
+
+std::pair<std::vector<token_t>, pp_err_t>
+preprocess_macro_blocks(const std::vector<token_t> &);
+
+std::pair<std::vector<token_t>, pp_err_t>
+preprocess_use_blocks(const std::vector<token_t> &);
+
+#endif