Skip to content

Commit eb019d2

Browse files
#TDP - 20 Add class Translate_ToCSharp
Add class Add method reverse Expression, declare function, declare condition, declare function expression, strArray correctCycleFor, getSymbol Operation/Separator/ ServiceWord/Identifier by code Move method from RPN to Translate -> isTypeDeclarationByCode isConst isCycle isIfCondition isElseCondition Add method to class Translate isTypeDeclaration TODO!!! REFACTORING class Translate_CSHARP!
1 parent 74484e9 commit eb019d2

19 files changed

+753
-98
lines changed

CodeCSharp.txt

Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
using System;
2+
3+
namespace from_C_to_C_Sharp
4+
{
5+
class Program
6+
{
7+
//W8 I1
8+
//W8 I2
9+
public int I3 (int I4)
10+
{
11+
int I5 = N1;
12+
while(I4 != N1)
13+
{
14+
I4 = I4 / N2;
15+
I5++ ;
16+
}
17+
W11 I5;
18+
}
19+
/*test comment*/
20+
public int I6 (int I4)
21+
{
22+
int I7 = I3(I4);
23+
int* I8 = (int*)W9(I7 * W10(int));
24+
int I9 = N1;
25+
while(I4 != N1)
26+
{
27+
I8[I9] = I4 % N2;
28+
I4 /= N2;
29+
I9++ ;
30+
}
31+
W11 I8;
32+
}
33+
// Main
34+
/* double
35+
comment
36+
*/
37+
static void Main(string[] args)
38+
{
39+
int I7 = I3(N3);
40+
int* I12 = I6(N3);
41+
int I13 = N1;
42+
for(int I14 = N1 ;I14 < I7 ;I14++)
43+
{
44+
if(I14 < N4 && I14 > N1)
45+
{
46+
I15(C1,I14,I12[I14]) ;
47+
}
48+
I12[I14] += I13 ;
49+
}
50+
I15(C2,I13);
51+
I16(I12) ;
52+
W11 N1;
53+
}
54+
}
55+
}

MethodsDevelopmentTranslator.vcxproj

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -138,6 +138,7 @@
138138
<ClCompile Include="function.cpp" />
139139
<ClCompile Include="ReversePolishNotation.cpp" />
140140
<ClCompile Include="SyntaxAnalisator.cpp" />
141+
<ClCompile Include="translate_csharp.cpp" />
141142
<ClCompile Include="Translator.cpp" />
142143
<ClCompile Include="Translator_LanguageC.cpp" />
143144
</ItemGroup>
@@ -146,6 +147,7 @@
146147
<ClInclude Include="include.h" />
147148
<ClInclude Include="ReversePolishNotation.h" />
148149
<ClInclude Include="SyntaxAnalisator.h" />
150+
<ClInclude Include="translate_csharp.h" />
149151
<ClInclude Include="Translator.h" />
150152
<ClInclude Include="Translator_LanguageC.h">
151153
<FileType>CppForm</FileType>
@@ -158,7 +160,9 @@
158160
</ItemGroup>
159161
<ItemGroup>
160162
<Text Include="C.txt" />
163+
<Text Include="CodeCSharp.txt" />
161164
<Text Include="lexical.txt" />
165+
<Text Include="RPN.txt" />
162166
<Text Include="test.txt" />
163167
</ItemGroup>
164168
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />

MethodsDevelopmentTranslator.vcxproj.filters

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,9 @@
3030
<ClCompile Include="ReversePolishNotation.cpp">
3131
<Filter>Исходные файлы</Filter>
3232
</ClCompile>
33+
<ClCompile Include="translate_csharp.cpp">
34+
<Filter>Исходные файлы</Filter>
35+
</ClCompile>
3336
</ItemGroup>
3437
<ItemGroup>
3538
<ClInclude Include="Translator_LanguageC.h">
@@ -50,6 +53,9 @@
5053
<ClInclude Include="ReversePolishNotation.h">
5154
<Filter>Файлы заголовков</Filter>
5255
</ClInclude>
56+
<ClInclude Include="translate_csharp.h">
57+
<Filter>Файлы заголовков</Filter>
58+
</ClInclude>
5359
</ItemGroup>
5460
<ItemGroup>
5561
<Text Include="C.txt">
@@ -61,5 +67,11 @@
6167
<Text Include="lexical.txt">
6268
<Filter>Файлы ресурсов</Filter>
6369
</Text>
70+
<Text Include="RPN.txt">
71+
<Filter>Файлы ресурсов</Filter>
72+
</Text>
73+
<Text Include="CodeCSharp.txt">
74+
<Filter>Файлы ресурсов</Filter>
75+
</Text>
6476
</ItemGroup>
6577
</Project>

RPN.txt

Lines changed: 23 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
W8 I1
22
W8 I2
33

4-
I3 I4 1 int 1 int
5-
11 ��
4+
I3 1 int I4 1 int
5+
1 1 ��
66
I5 1 int N1 O5
77
I4 N1 O10
88
��1 ���
@@ -12,35 +12,40 @@ I5 O20
1212
I5 W11
1313
��
1414

15-
I6 I4 1 int 1 int
16-
21 ��
17-
I7 1 int I3 I4 2 � O5
18-
I8 1 int* W9 I7 W10 1 int 2 � O3 2 � 1 int* O5
15+
/*test comment*/
16+
I6 1 int I4 1 int
17+
2 1 ��
18+
I7 1 int I3 I4 2� O5
19+
I8 1 int* W9 I7 W10 1 int 2� O3 2� 1 int* O5
1920
I9 1 int N1 O5
2021
I4 N1 O10
2122
��1 ���
2223
I8 I9 2��� I4 N2 O6 O5
23-
I4 O4 N2 O5
24+
I4 N2 O13
2425
I9 O20
2526
��1:
2627
I8 W11
2728
��
2829

29-
W4 I10 1int I11 1��� 1 const char* 1 int
30-
31 ��
31-
I7 1 int I3 N3 2 � O5
32-
1 int I12 O3 I6 N3 2 � O5
30+
// Main
31+
/* double
32+
comment
33+
*/
34+
W4 1 int I10 1 int I11 1��� 1 const char*
35+
3 1 ��
36+
I7 1 int I3 N3 2� O5
37+
I12 1 int* I6 N3 2� O5
3338
I13 1 int N1 O5
3439
I14 1 int N1 O5 I14 I7 O8 I14 O20
35-
��1 ���
36-
I14 N4 O8 I14 O17 N1 O7
40+
��1 ���
41+
I14 N4 O8 I14 N1 O7 O17
3742
�1 ���
38-
I15 C1 I14 I12 I14 2��� 4
43+
I15 C1 I14 I12 I14 2��� 4�
3944
�1:
40-
I13 O1 I12 I14 2��� O5
41-
��1:
42-
I15 C2 I13 3
43-
I16 I12 2
45+
I13 I12 I14 2��� O14
46+
��1:
47+
I15 C2 I13 3�
48+
I16 I12 2�
4449
N1 W11
4550
��
4651

0 commit comments

Comments
 (0)