summaryrefslogtreecommitdiffhomepage
path: root/cpp.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'cpp.cpp')
-rw-r--r--cpp.cpp33
1 files changed, 27 insertions, 6 deletions
diff --git a/cpp.cpp b/cpp.cpp
index 67c76ef..73f11e1 100644
--- a/cpp.cpp
+++ b/cpp.cpp
@@ -243,18 +243,39 @@ void CPP::link()
// phases of translation, according to standard
void CPP::translate(const std::string& code)
{
-#if 0 // fix signatures!
source_charset_map();
+
backslash_escape();
- preprocessing_tokenize(code);
+
+ auto pp_tokens = preprocessing_tokenize(code);
+
preprocess();
+
execution_charset_map();
+
concatenate_strings();
- tokens_from_pptokens();
- analysis();
- translate();
+
+ auto tokens = tokens_from_pptokens(pp_tokens);
+ auto nodes = analysis(tokens);
+ translate();
+
instantiate();
+
link();
-#endif
+}
+
+std::vector<uint8_t> CPP::getCode()
+{
+ // TODO
+ return {
+ 0x48, 0xc7, 0xc0, 0x3c, 0x00, 0x00, 0x00, // mov $0x3c,%rax # syscall 60
+ 0x48, 0x31, 0xff, // xor %rdi,%rdi # exit code 0
+ 0x0f, 0x05, // syscall
+ };
+}
+
+std::vector<uint8_t> CPP::getData()
+{
+ return {}; // TODO
}