blob: 5ec43fb1cc867ae43bae8448fcf6d9f4d5baade8 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
|
#pragma once
#include "grammer.h"
#include "minicc.h"
#include <vector>
class CPP {
public:
CPP();
~CPP();
std::string valueOfNode(index_t node_index, const std::vector<Gram::TreeNode>& Tree);
static void PreprocessorTokensToTokens(std::vector<Token>& tokens); // obsolete
// phases of translation, according to standard
void source_charset_map(); // phase 1
void backslash_escape(); // phase 2
std::pair<index_t, std::vector<Gram::TreeNode>> preprocessing_tokenize(const std::string& s); // phase 3
void preprocess(); // phase 4
void execution_charset_map(); // phase 5
void concatenate_strings(); // phase 6
std::vector<Token> tokens_from_pptokens(std::pair<index_t, std::vector<Gram::TreeNode>> Tree); // phase 7.a
std::pair<index_t, std::vector<Gram::TreeNode>> analysis(std::vector<Token>); // phase 7.b
void translate(); // phase 7.c
void instantiate(); // phase 8
void link(); // phase 9
// all phases of translation
void translate(const std::string& code);
private:
std::string m_code;
std::vector<Token> m_charTokens;
};
|