summaryrefslogtreecommitdiffhomepage
path: root/cpp.cpp
blob: 54dd0d2e3dc894cf9e4f8b9e90550bdafea8df01 (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
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
#include "cpp.h"

#include <gtest/gtest.h>
#include <gmock/gmock.h>

void CPP::PreprocessorTokensToTokens(std::vector<Token>& 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();
}