#include "cpp.h" #include #include void CPP::PreprocessorTokensToTokens(std::vector& tokens) { for (auto& i : tokens) { if (i.type == "preprocessing-op-or-punc") i.type = i.value; } } // Phase 1: Map physical character set to basic source character set void CPP::source_charset_map() { // TODO } // Phase 2: Escape backslashed line endings void CPP::backslash_escape() { // TODO } // Phase 3: Parse preprocessing tokens void CPP::preprocessing_tokenize() { // TODO } // Phase 4: Preprocessing void CPP::preprocess() { // TODO } // Phase 5: Map chars and strings to execution charset void CPP::execution_charset_map() { // TODO } // Phase 6: Concatenate adjacent string literals void CPP::concatenate_strings() { // TODO } // Phase 7: Create tokens from preprocessing tokens void CPP::tokens_from_pptokens() { } // Phase 8: Instantiate objects void CPP::instantiate() { } // Phase 9: Link libraries void CPP::link() { } // phases of translation, according to standard void CPP::translate() { source_charset_map(); backslash_escape(); preprocessing_tokenize(); preprocess(); execution_charset_map(); concatenate_strings(); tokens_from_pptokens(); instantiate(); link(); } TEST(Cpp, translate) { CPP::translate(); }