├── .gitattributes
├── .gitignore
├── 13071079_卢嵩_设计文档.docx
├── C0-Compiler
├── .vs
│ └── C0-Compiler
│ │ └── v14
│ │ └── .suo
├── C0-Compiler.VC.db
├── C0-Compiler.sdf
├── C0-Compiler.sln
├── C0-Compiler.sln.docstates.suo
├── C0-Compiler.suo
├── C0-Compiler
│ ├── 13071079_test - 副本.txt
│ ├── 13071079_test.txt
│ ├── 13071079_test2.txt
│ ├── 13071079_test3.txt
│ ├── 13071079_test4.txt
│ ├── 13071079_test_asm.txt
│ ├── 13071079_test_mid.txt
│ ├── C0-Compiler.cpp
│ ├── C0-Compiler.vcxproj
│ ├── C0-Compiler.vcxproj.filters
│ ├── C0-Compiler.vcxproj.user
│ ├── Debug
│ │ ├── C0-Compiler.Build.CppClean.log
│ │ └── C0-Compiler.log
│ ├── Generator.cpp
│ ├── Generator.h
│ ├── Lexer.h
│ ├── Optimizer.cpp
│ ├── Parser.cpp
│ ├── Parser.h
│ ├── Quadruple.cpp
│ ├── Quadruple.h
│ ├── ReadMe.txt
│ ├── Release
│ │ ├── C0-Compiler.exe.intermediate.manifest
│ │ ├── C0-Compiler.lastbuildstate
│ │ ├── C0-Compiler.log
│ │ ├── C0-Compiler.obj
│ │ ├── C0-Compiler.pch
│ │ ├── CL.read.1.tlog
│ │ ├── CL.write.1.tlog
│ │ ├── Generator.obj
│ │ ├── Lexer.obj
│ │ ├── Optimizer.obj
│ │ ├── Parser.obj
│ │ ├── Quadruple.obj
│ │ ├── Table.obj
│ │ ├── TableItem.obj
│ │ ├── cl.command.1.tlog
│ │ ├── link.command.1.tlog
│ │ ├── link.read.1.tlog
│ │ ├── link.write.1.tlog
│ │ ├── mt.command.1.tlog
│ │ ├── mt.read.1.tlog
│ │ ├── mt.write.1.tlog
│ │ ├── stdafx.obj
│ │ └── vc100.pdb
│ ├── Table.cpp
│ ├── Table.h
│ ├── TableItem.cpp
│ ├── TableItem.h
│ ├── defination.h
│ ├── error.cpp
│ ├── error.h
│ ├── global.h
│ ├── lexer.cpp
│ ├── output.txt
│ ├── stdafx.cpp
│ ├── stdafx.h
│ └── targetver.h
├── Release
│ ├── C0-Compiler.exe
│ └── C0-Compiler.pdb
└── ipch
│ └── C0-COMPILER-123a5ca4
│ ├── C0-COMPILER-71350ee1.ipch
│ └── C0-COMPILER-91eab227.ipch
├── README.md
├── wordAnalyze
├── Debug
│ ├── wordAnalyze.exe
│ ├── wordAnalyze.ilk
│ └── wordAnalyze.pdb
├── ipch
│ └── wordanalyze-55f47603
│ │ └── wordanalyze-d925b2bc.ipch
├── wordAnalyze.sdf
├── wordAnalyze.sln
├── wordAnalyze.suo
└── wordAnalyze
│ ├── 13071079_test.txt
│ ├── Debug
│ ├── CL.read.1.tlog
│ ├── CL.write.1.tlog
│ ├── cl.command.1.tlog
│ ├── lex.obj
│ ├── link-cvtres.read.1.tlog
│ ├── link-cvtres.write.1.tlog
│ ├── link.10196-cvtres.read.1.tlog
│ ├── link.10196-cvtres.write.1.tlog
│ ├── link.10196.read.1.tlog
│ ├── link.10196.write.1.tlog
│ ├── link.10460-cvtres.read.1.tlog
│ ├── link.10460-cvtres.write.1.tlog
│ ├── link.10460.read.1.tlog
│ ├── link.10460.write.1.tlog
│ ├── link.10924-cvtres.read.1.tlog
│ ├── link.10924-cvtres.write.1.tlog
│ ├── link.10924.read.1.tlog
│ ├── link.10924.write.1.tlog
│ ├── link.1104-cvtres.read.1.tlog
│ ├── link.1104-cvtres.write.1.tlog
│ ├── link.1104.read.1.tlog
│ ├── link.1104.write.1.tlog
│ ├── link.11356-cvtres.read.1.tlog
│ ├── link.11356-cvtres.write.1.tlog
│ ├── link.11356.read.1.tlog
│ ├── link.11356.write.1.tlog
│ ├── link.1212-cvtres.read.1.tlog
│ ├── link.1212-cvtres.write.1.tlog
│ ├── link.1212.read.1.tlog
│ ├── link.1212.write.1.tlog
│ ├── link.12908-cvtres.read.1.tlog
│ ├── link.12908-cvtres.write.1.tlog
│ ├── link.12908.read.1.tlog
│ ├── link.12908.write.1.tlog
│ ├── link.13156-cvtres.read.1.tlog
│ ├── link.13156-cvtres.write.1.tlog
│ ├── link.13156.read.1.tlog
│ ├── link.13156.write.1.tlog
│ ├── link.3576-cvtres.read.1.tlog
│ ├── link.3576-cvtres.write.1.tlog
│ ├── link.3576.read.1.tlog
│ ├── link.3576.write.1.tlog
│ ├── link.4168-cvtres.read.1.tlog
│ ├── link.4168-cvtres.write.1.tlog
│ ├── link.4168.read.1.tlog
│ ├── link.4168.write.1.tlog
│ ├── link.4324-cvtres.read.1.tlog
│ ├── link.4324-cvtres.write.1.tlog
│ ├── link.4324.read.1.tlog
│ ├── link.4324.write.1.tlog
│ ├── link.5560-cvtres.read.1.tlog
│ ├── link.5560-cvtres.write.1.tlog
│ ├── link.5560.read.1.tlog
│ ├── link.5560.write.1.tlog
│ ├── link.5864-cvtres.read.1.tlog
│ ├── link.5864-cvtres.write.1.tlog
│ ├── link.5864.read.1.tlog
│ ├── link.5864.write.1.tlog
│ ├── link.7248-cvtres.read.1.tlog
│ ├── link.7248-cvtres.write.1.tlog
│ ├── link.7248.read.1.tlog
│ ├── link.7248.write.1.tlog
│ ├── link.8276-cvtres.read.1.tlog
│ ├── link.8276-cvtres.write.1.tlog
│ ├── link.8276.read.1.tlog
│ ├── link.8276.write.1.tlog
│ ├── link.8568-cvtres.read.1.tlog
│ ├── link.8568-cvtres.write.1.tlog
│ ├── link.8568.read.1.tlog
│ ├── link.8568.write.1.tlog
│ ├── link.8780-cvtres.read.1.tlog
│ ├── link.8780-cvtres.write.1.tlog
│ ├── link.8780.read.1.tlog
│ ├── link.8780.write.1.tlog
│ ├── link.932-cvtres.read.1.tlog
│ ├── link.932-cvtres.write.1.tlog
│ ├── link.932.read.1.tlog
│ ├── link.932.write.1.tlog
│ ├── link.9876-cvtres.read.1.tlog
│ ├── link.9876-cvtres.write.1.tlog
│ ├── link.9876.read.1.tlog
│ ├── link.9876.write.1.tlog
│ ├── link.9984-cvtres.read.1.tlog
│ ├── link.9984-cvtres.write.1.tlog
│ ├── link.9984.read.1.tlog
│ ├── link.9984.write.1.tlog
│ ├── link.command.1.tlog
│ ├── link.read.1.tlog
│ ├── link.write.1.tlog
│ ├── mt.command.1.tlog
│ ├── mt.read.1.tlog
│ ├── mt.write.1.tlog
│ ├── rc.command.1.tlog
│ ├── rc.read.1.tlog
│ ├── rc.write.1.tlog
│ ├── stdafx.obj
│ ├── vc100.idb
│ ├── vc100.pdb
│ ├── wordAnalyze.exe.embed.manifest
│ ├── wordAnalyze.exe.embed.manifest.res
│ ├── wordAnalyze.exe.intermediate.manifest
│ ├── wordAnalyze.lastbuildstate
│ ├── wordAnalyze.log
│ ├── wordAnalyze.obj
│ ├── wordAnalyze.pch
│ ├── wordAnalyze.vcxprojResolveAssemblyReference.cache
│ ├── wordAnalyze.write.1.tlog
│ └── wordAnalyze_manifest.rc
│ ├── ReadMe.txt
│ ├── output.txt
│ ├── stdafx.cpp
│ ├── stdafx.h
│ ├── targetver.h
│ ├── test.txt
│ ├── wordAnalyze.vcxproj
│ ├── wordAnalyze.vcxproj.filters
│ └── wordAnalyze.vcxproj.user
├── ~$071079_卢嵩_设计文档.docx
├── 中间代码备忘.xlsx
├── 数组嵌套.txt
├── 文法解读
├── 13071079_result.txt
├── 13071079_test.txt
└── 13071079_卢嵩_文法解读.docx
├── 测试集_张诚.txt
├── 测试集_李毅成.txt
└── 调用关系.vsdx
/.gitattributes:
--------------------------------------------------------------------------------
1 | # Auto detect text files and perform LF normalization
2 | * text=auto
3 |
4 | # Custom for Visual Studio
5 | *.cs diff=csharp
6 |
7 | # Standard to msysgit
8 | *.doc diff=astextplain
9 | *.DOC diff=astextplain
10 | *.docx diff=astextplain
11 | *.DOCX diff=astextplain
12 | *.dot diff=astextplain
13 | *.DOT diff=astextplain
14 | *.pdf diff=astextplain
15 | *.PDF diff=astextplain
16 | *.rtf diff=astextplain
17 | *.RTF diff=astextplain
18 |
--------------------------------------------------------------------------------
/.gitignore:
--------------------------------------------------------------------------------
1 | # Windows image file caches
2 | Thumbs.db
3 | ehthumbs.db
4 |
5 | # Folder config file
6 | Desktop.ini
7 |
8 | # Recycle Bin used on file shares
9 | $RECYCLE.BIN/
10 |
11 | # Windows Installer files
12 | *.cab
13 | *.msi
14 | *.msm
15 | *.msp
16 |
17 | # Windows shortcuts
18 | *.lnk
19 |
20 | # =========================
21 | # Operating System Files
22 | # =========================
23 |
24 | # OSX
25 | # =========================
26 |
27 | .DS_Store
28 | .AppleDouble
29 | .LSOverride
30 |
31 | # Thumbnails
32 | ._*
33 |
34 | # Files that might appear in the root of a volume
35 | .DocumentRevisions-V100
36 | .fseventsd
37 | .Spotlight-V100
38 | .TemporaryItems
39 | .Trashes
40 | .VolumeIcon.icns
41 |
42 | # Directories potentially created on remote AFP share
43 | .AppleDB
44 | .AppleDesktop
45 | Network Trash Folder
46 | Temporary Items
47 | .apdisk
48 |
--------------------------------------------------------------------------------
/13071079_卢嵩_设计文档.docx:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/luxiaodou/CompilerAssignments/28d2d0c63789aed3c4c0823e057669b5ca5f4800/13071079_卢嵩_设计文档.docx
--------------------------------------------------------------------------------
/C0-Compiler/.vs/C0-Compiler/v14/.suo:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/luxiaodou/CompilerAssignments/28d2d0c63789aed3c4c0823e057669b5ca5f4800/C0-Compiler/.vs/C0-Compiler/v14/.suo
--------------------------------------------------------------------------------
/C0-Compiler/C0-Compiler.VC.db:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/luxiaodou/CompilerAssignments/28d2d0c63789aed3c4c0823e057669b5ca5f4800/C0-Compiler/C0-Compiler.VC.db
--------------------------------------------------------------------------------
/C0-Compiler/C0-Compiler.sdf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/luxiaodou/CompilerAssignments/28d2d0c63789aed3c4c0823e057669b5ca5f4800/C0-Compiler/C0-Compiler.sdf
--------------------------------------------------------------------------------
/C0-Compiler/C0-Compiler.sln:
--------------------------------------------------------------------------------
1 |
2 | Microsoft Visual Studio Solution File, Format Version 11.00
3 | # Visual Studio 2010
4 | Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "C0-Compiler", "C0-Compiler\C0-Compiler.vcxproj", "{B5782598-15E5-4A29-A78C-7969A38BE9CD}"
5 | EndProject
6 | Global
7 | GlobalSection(SolutionConfigurationPlatforms) = preSolution
8 | Debug|Win32 = Debug|Win32
9 | Release|Win32 = Release|Win32
10 | EndGlobalSection
11 | GlobalSection(ProjectConfigurationPlatforms) = postSolution
12 | {B5782598-15E5-4A29-A78C-7969A38BE9CD}.Debug|Win32.ActiveCfg = Debug|Win32
13 | {B5782598-15E5-4A29-A78C-7969A38BE9CD}.Debug|Win32.Build.0 = Debug|Win32
14 | {B5782598-15E5-4A29-A78C-7969A38BE9CD}.Release|Win32.ActiveCfg = Release|Win32
15 | {B5782598-15E5-4A29-A78C-7969A38BE9CD}.Release|Win32.Build.0 = Release|Win32
16 | EndGlobalSection
17 | GlobalSection(SolutionProperties) = preSolution
18 | HideSolutionNode = FALSE
19 | EndGlobalSection
20 | EndGlobal
21 |
--------------------------------------------------------------------------------
/C0-Compiler/C0-Compiler.sln.docstates.suo:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/luxiaodou/CompilerAssignments/28d2d0c63789aed3c4c0823e057669b5ca5f4800/C0-Compiler/C0-Compiler.sln.docstates.suo
--------------------------------------------------------------------------------
/C0-Compiler/C0-Compiler.suo:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/luxiaodou/CompilerAssignments/28d2d0c63789aed3c4c0823e057669b5ca5f4800/C0-Compiler/C0-Compiler.suo
--------------------------------------------------------------------------------
/C0-Compiler/C0-Compiler/13071079_test - 副本.txt:
--------------------------------------------------------------------------------
1 | const int ca=+15,cb=-30507, cg = 0;
2 | const int CA=-15,CB=-20, CG = 9;
3 | const char cc='a',cd='+',ce='*', ch = '0';
4 | const char cf='_' ;
5 |
6 | int va1,vd,vb[4];
7 | char vc[3];
8 |
9 | int func1(int a,int b){
10 | int c;
11 | c=+a-b-3*2;
12 | c=-a/c*b; ;
13 | return (c);
14 | }
15 |
16 | char func3(char d){
17 | char c;
18 | c=d;
19 | return (c);
20 | }
21 |
22 | void fprintf(){
23 | printf(" !#$%&'()*+,-./0123456789:;<=>? @ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}");
24 | printf(+ca+cb);
25 | printf("hello world",cf);
26 | }
27 |
28 | int f(int n){
29 | if (n <= 0){
30 | printf("error!");
31 | return;
32 | }
33 | if (n == 1)
34 | return (1);
35 | if (n == 2)
36 | return (1);
37 | return (f(n-1) + f(n-2));
38 | }
39 |
40 | void relationcover(int n){
41 | const char ch = 'b';
42 | if (n <=0) {
43 | if (ch < 6)
44 | printf("LESS");
45 | if (ch <= 7)
46 | printf("LESSEQU");
47 | if (ch == 8)
48 | printf("EQU");
49 | if (ch > 11)
50 | printf("GREAT");
51 | if (ch >= 11)
52 | printf("GREATEQU");
53 | if (ch != 11)
54 | printf("NOTEQU");
55 | }
56 | }
57 |
58 | void whiletest(){
59 | int temp;
60 | int i;
61 | i = 0;
62 | while (i < 4){
63 | vb[i] = i;
64 | i= i+1;
65 | }
66 | while (i < 4){
67 | temp = vb[i];
68 | i = i +1;
69 | printf((temp));
70 | }
71 | }
72 |
73 | void main(){
74 | int flag;
75 | int re;
76 | char ccal,ccal2;
77 | scanf(flag);
78 | scanf(va1,vd);
79 | vc[0] = 1;
80 | ccal = cc + ca;
81 | ccal2 = cc + cd - ce;
82 | printf(ccal);
83 |
84 | if (ca != CA)
85 | printf("case sensitive!");
86 | if (flag == 3)
87 | fprintf();
88 | if (va1-vd){
89 | vd=func1(va1,vd);
90 | printf(-vd);
91 | }
92 | switch(flag){
93 | case 0 : {
94 | switch(va1) {
95 | case 0:
96 | case 1: {
97 | va1 = func3(cc + 1);
98 | printf(va1);
99 | }
100 | case 2: whiletest();
101 | default: {
102 | va1 = f(va1);
103 | printf(va1);
104 | }
105 | }
106 | }
107 | case 1 : relationcover(va1);
108 | }
109 | re = va1;
110 | return (re);
111 | }
--------------------------------------------------------------------------------
/C0-Compiler/C0-Compiler/13071079_test.txt:
--------------------------------------------------------------------------------
1 | const int ca=2147483647,cb=-2147483648, cg = 0;
2 | const int CA=-15,CB=-20, CG = 9;
3 | const char cc='a',cd='+',ce='*', ch = '0';
4 | const char cf='_' ;
5 |
6 | int va;
7 | char vb;
8 | int vc,vd,arr[10];
9 | char charr[3];
10 |
11 | void tempadd(int w){
12 | w = w+1;
13 | printf(w);
14 | }
15 |
16 | void caltest() {
17 | int a,b,c,d,e;
18 | a = -13++79;
19 | b = 13 +-97;
20 | c = 13*-79;
21 | d = 79/-13;
22 | e = 1079 * 18 - +24 *5 +9/-2;
23 | printf(a);
24 | printf(b);
25 | printf(c);
26 | printf(d);
27 | printf(e);
28 | return;
29 | }
30 |
31 | char returnq(){
32 | return ('Q');
33 | }
34 |
35 | void whiletest(){
36 | int i;
37 | i = 0;
38 | while (i < 10){
39 | i = i+1;
40 | printf("in circle", i);
41 | }
42 | return;
43 | }
44 |
45 | int switchtest(int a){
46 | switch(a) {
47 | case 1 : printf("reached 1");
48 | case 2 : {
49 | printf("into to brace");
50 | return (50);
51 | }
52 | case 3 : {whiletest(); return(233);}
53 | default : printf("default reached!");
54 | }
55 | return (0);
56 | }
57 |
58 | char relationcover(char c) {
59 | int a,count;
60 | char b;
61 | if(c == 'a') {
62 | count = 0;
63 | a = 97;
64 | b = 'a';
65 | if(a == c) {
66 | printf("same?");
67 | count = count +1;
68 | }
69 | if (b == c) {
70 | printf("still same?");
71 | count = count +1;
72 | }
73 | if(count == 2)
74 | printf("EQU is good");
75 | a = 111;
76 | }
77 | if (a != 110) {
78 | count = 0;
79 | if(c != b){
80 | count = count +1;
81 | printf("you cant see this");
82 | }
83 | if(a != 111){
84 | count = count +1;
85 | printf("cannot see this neither");
86 | }
87 | if(a != c){
88 | count = count +1;
89 | printf("maybe this is ok");
90 | }
91 | if(count == 1){
92 | printf("NEQ is good");
93 | }
94 | a = 100;
95 | }
96 | if (a > 99) {
97 | count =0;
98 | if (a > count)
99 | count = count +1;
100 | if (a > c)
101 | count = count +1;
102 | if (a > 99)
103 | if (a > 98)
104 | count = count +1;
105 | if(count == 3){
106 | printf("Greater is good");
107 | }
108 | a = 77;
109 | }
110 | if (a <88) {
111 | count = 0;
112 | if(a < c)
113 | count = count +1;
114 | if(b < c)
115 | count = count +1;
116 | if(count < a)
117 | count = count +1;
118 | if(count == 2)
119 | printf("Less is good");
120 | }
121 | if (a >=66){
122 | count = 0;
123 | if(a >= 50)
124 | count = count +1;
125 | if(a >= c)
126 | count = count +1;
127 | if(b >=c)
128 | count = count +1;
129 | if(count ==2)
130 | printf("GTE is good");
131 | }
132 | if (a <= 111) {
133 | count = 0;
134 | if(c <= a)
135 | count =count +1;
136 | if (b <=c)
137 | count = count +1;
138 | if(a <= 1000)
139 | count = count +1;
140 | if(count ==2)
141 | printf("LTE is good");
142 | count = 1;
143 | }
144 | if (count)
145 | printf("you can see this for count =",a);
146 | count = 0;
147 | if (count)
148 | printf("but you should never see this");
149 | return (c);
150 | }
151 |
152 | int f(int n){
153 | if (n <= 0){
154 | printf("error!");
155 | return;
156 | }
157 | if (n == 1)
158 | return (1);
159 | if (n == 2)
160 | return (1);
161 | return (f(n-1) + f(n-2));
162 | }
163 |
164 | void main(){
165 | int cg,flag1,re3;
166 | int re1,para;
167 | char flag2;
168 | char c,re2,cn[6];
169 | printf("Calculate test begin");
170 | tempadd(15);
171 | caltest();
172 | printf("printf test start!");
173 | printf(" !#$%&'()*+,-./0123456789:;<=>? @ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}");
174 | printf("Max & Min integer:",ca);
175 | printf(cb);
176 | printf("assign test start!");
177 | cg = 10;
178 | va = CA;
179 | arr[0] = 233;
180 | charr[1] = 81;
181 | cn[3] = 43;
182 | vb = charr[1];
183 | printf(va);
184 | printf(arr[0]);
185 | printf(charr[1]);
186 | printf(cn[3]);
187 | printf(vb);
188 | printf("print char:", ce);
189 | printf(cc);
190 | printf(returnq());
191 | printf("print expression");
192 | printf(ca + cb);
193 | printf(ch + ch);
194 | printf(ch + CG);
195 | printf(ca + cb);
196 | printf("local or global?");
197 | if(cg == 0){
198 | printf("global");
199 | }
200 | if(cg == 10){
201 | printf("local");
202 | }
203 | if(CA == ca){
204 | printf("not case sensitive!");
205 | }
206 | if(ca != CA){
207 | printf("case sensitive!");
208 | }
209 | printf("scanf test start! Please input 1 int then 1 char then another int!");
210 | scanf(flag1, flag2,vc);
211 | printf("");
212 | printf("The first one:",flag1);
213 | printf("The second one:", flag2);
214 | printf("Global is: ",vc);
215 | printf("start while test!");
216 | whiletest();
217 | printf("while test finished!\nbegin switchtest!");
218 | para = 1;
219 | re1 = switchtest(para);
220 | printf("get result:",re1);
221 | para = 2;
222 | re1 = switchtest(para);
223 | printf("get result:",re1);
224 | para = 3;
225 | re1 = switchtest(para);
226 | printf("get result:",re1);
227 | para = 4;
228 | re1 = switchtest(para);
229 | printf("get result:",re1);
230 | printf("start relationcover!");
231 | c = 'a';
232 | re2 = relationcover(c);
233 | printf(re2);
234 | printf("start recursive!");
235 | para = 20;
236 | re3 = f(para);
237 | printf(re3);
238 | }
--------------------------------------------------------------------------------
/C0-Compiler/C0-Compiler/13071079_test2.txt:
--------------------------------------------------------------------------------
1 | const int ca=2147483647,cb=-2147483648, cg = 0;
2 | const int CA=-15,CB=-20, CG = 9;
3 | const char cc='a',cd='+',ce='*', ch = '0';
4 | const char cf='_' ;
5 |
6 | int va;
7 | char vb;
8 | int vc,vd,arr[10];
9 | char charr[3];
10 |
11 | void tempadd(int w){
12 | w = w+1;
13 | printf(w);
14 | }
15 |
16 | int switchtest2(char a){
17 | switch(a) {
18 | case 'a' : printf("reached a");
19 | case 'b' : {
20 | printf("into to brace");
21 | return (50);
22 | }
23 | default : printf("default reached!");
24 | }
25 | return (0);
26 | }
27 |
28 | void main(){
29 | int cg,flag1,re3;
30 | int re1,para;
31 | char flag2;
32 | char c,re2,cn[6];
33 | c = 'b';
34 | printf(switchtest2(c));
35 | c = 'a';
36 | printf(switchtest2(c));
37 | }
--------------------------------------------------------------------------------
/C0-Compiler/C0-Compiler/13071079_test3.txt:
--------------------------------------------------------------------------------
1 | void whiletest(){
2 | int i;
3 | i = 0;
4 | while (i < 10){
5 | i = i+1;
6 | printf("in circle", i);
7 | }
8 | }
9 |
10 | int switchtest(int a){
11 | switch(a) {
12 | case 1 : printf("reached 1");
13 | case 2 : {
14 | printf("into to brace");
15 | return (50);
16 | }
17 | case 3 : {whiletest(); return(233);}
18 | default : printf("default reached!");
19 | }
20 | return (0);
21 | }
22 |
23 | void main(){
24 | int re1,para;
25 | printf("start while test!");
26 | whiletest();
27 | printf("while test finished!\nbegin switchtest!");
28 | para = 1;
29 | re1 = switchtest(para);
30 | printf("get result:",re1);
31 | para = 2;
32 | re1 = switchtest(para);
33 | printf("get result:",re1);
34 | para = 3;
35 | re1 = switchtest(para);
36 | printf("get result:",re1);
37 | para = 4;
38 | re1 = switchtest(para);
39 | printf("get result:",re1);
40 | }
--------------------------------------------------------------------------------
/C0-Compiler/C0-Compiler/13071079_test4.txt:
--------------------------------------------------------------------------------
1 | char relationcover(char c) {
2 | int a,count;
3 | char b;
4 | if(c == 'a') {
5 | count = 0;
6 | a = 97;
7 | b = 'a';
8 | if(a == c) {
9 | printf("same?");
10 | count = count +1;
11 | }
12 | if (b == c) {
13 | printf("still same?");
14 | count = count +1;
15 | }
16 | if(count == 2)
17 | printf("EQU is good");
18 | a = 111;
19 | }
20 | if (a != 110) {
21 | count = 0;
22 | if(c != b){
23 | count = count +1;
24 | printf("you cant see this");
25 | }
26 | if(a != 111){
27 | count = count +1;
28 | printf("cannot see this neither");
29 | }
30 | if(a != c){
31 | count = count +1;
32 | printf("maybe this is ok");
33 | }
34 | if(count == 1){
35 | printf("NEQ is good");
36 | }
37 | a = 100;
38 | }
39 | if (a > 99) {
40 | count =0;
41 | if (a > count)
42 | count = count +1;
43 | if (a > c)
44 | count = count +1;
45 | if (a > 99)
46 | if (a > 98)
47 | count = count +1;
48 | if(count == 3){
49 | printf("Greater is good");
50 | }
51 | a = 77;
52 | }
53 | if (a <88) {
54 | count = 0;
55 | if(a < c)
56 | count = count +1;
57 | if(b < c)
58 | count = count +1;
59 | if(count < a)
60 | count = count +1;
61 | if(count == 2)
62 | printf("Less is good");
63 | }
64 | if (a >=66){
65 | count = 0;
66 | if(a >= 50)
67 | count = count +1;
68 | if(a >= c)
69 | count = count +1;
70 | if(b >=c)
71 | count = count +1;
72 | if(count ==2)
73 | printf("GTE is good");
74 | }
75 | if (a <= 111) {
76 | count = 0;
77 | if(c <= a)
78 | count =count +1;
79 | if (b <=c)
80 | count = count +1;
81 | if(a <= 1000)
82 | count = count +1;
83 | if(count ==2)
84 | printf("LTE is good");
85 | }
86 | return (c);
87 | }
88 |
89 | void main(){
90 | int re1,para;
91 | char c,re2;
92 | printf("start relationcover!");
93 | c = 'a';
94 | re2 = relationcover(c);
95 | printf(re2);
96 | }
--------------------------------------------------------------------------------
/C0-Compiler/C0-Compiler/13071079_test_asm.txt:
--------------------------------------------------------------------------------
1 | .data
2 | ca: .word 2147483647
3 | cb: .word -2147483648
4 | cg: .word 0
5 | CA: .word -15
6 | CB: .word -20
7 | CG: .word 9
8 | cc: .word 97
9 | cd: .word 43
10 | ce: .word 42
11 | ch: .word 48
12 | cf: .word 95
13 | va: .space 4
14 | vb: .space 4
15 | vc: .space 4
16 | vd: .space 4
17 | arr: .word 1:10
18 | charr: .word 1:3
19 | $enter: .asciiz "\n"
20 | $string0: .asciiz "in circle"
21 | $string1: .asciiz "reached 1"
22 | $string10: .asciiz "NEQ is good"
23 | $string11: .asciiz "Greater is good"
24 | $string12: .asciiz "Less is good"
25 | $string13: .asciiz "GTE is good"
26 | $string14: .asciiz "LTE is good"
27 | $string15: .asciiz "you can see this for count ="
28 | $string16: .asciiz "but you should never see this"
29 | $string17: .asciiz "error!"
30 | $string18: .asciiz "Calculate test begin"
31 | $string19: .asciiz "printf test start!"
32 | $string2: .asciiz "into to brace"
33 | $string20: .asciiz " !#$%&'()*+,-./0123456789:;<=>? @ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}"
34 | $string21: .asciiz "Max & Min integer:"
35 | $string22: .asciiz "assign test start!"
36 | $string23: .asciiz "print char:"
37 | $string24: .asciiz "print expression"
38 | $string25: .asciiz "local or global?"
39 | $string26: .asciiz "global"
40 | $string27: .asciiz "local"
41 | $string28: .asciiz "not case sensitive!"
42 | $string29: .asciiz "case sensitive!"
43 | $string3: .asciiz "default reached!"
44 | $string30: .asciiz "scanf test start! Please input 1 int then 1 char then another int!"
45 | $string31: .asciiz ""
46 | $string32: .asciiz "The first one:"
47 | $string33: .asciiz "The second one:"
48 | $string34: .asciiz "Global is: "
49 | $string35: .asciiz "start while test!"
50 | $string36: .asciiz "while test finished!\nbegin switchtest!"
51 | $string37: .asciiz "get result:"
52 | $string38: .asciiz "start relationcover!"
53 | $string39: .asciiz "start recursive!"
54 | $string4: .asciiz "same?"
55 | $string5: .asciiz "still same?"
56 | $string6: .asciiz "EQU is good"
57 | $string7: .asciiz "you cant see this"
58 | $string8: .asciiz "cannot see this neither"
59 | $string9: .asciiz "maybe this is ok"
60 | .text
61 | j main
62 | tempadd:
63 | subi $sp, $sp,20
64 | sw $ra,0($sp)
65 | lw $t0,4($sp)
66 | sw $t0,8($sp)
67 | li $t0,1
68 | sw $t0,12($sp)
69 | lw $t0,8($sp)
70 | lw $t1,12($sp)
71 | add $t2,$t1,$t0
72 | sw $t2,8($sp)
73 | lw $t0,8($sp)
74 | sw $t0,4($sp)
75 | lw $t0,4($sp)
76 | sw $t0,16($sp)
77 | li $v0, 1
78 | lw $a0,16($sp)
79 | syscall
80 | li $v0, 4
81 | la $a0,$enter
82 | syscall
83 | lw $ra,0($sp)
84 | addi $sp,$sp,20
85 | jr $ra
86 | caltest:
87 | subi $sp, $sp,100
88 | sw $ra,0($sp)
89 | li $t0,13
90 | sw $t0,24($sp)
91 | lw $t0,24($sp)
92 | sub $t0,$0,$t0
93 | sw $t0,24($sp)
94 | li $t0,79
95 | sw $t0,28($sp)
96 | lw $t0,24($sp)
97 | lw $t1,28($sp)
98 | add $t2,$t1,$t0
99 | sw $t2,24($sp)
100 | lw $t0,24($sp)
101 | sw $t0,4($sp)
102 | li $t0,13
103 | sw $t0,32($sp)
104 | li $t0,-97
105 | sw $t0,36($sp)
106 | lw $t0,32($sp)
107 | lw $t1,36($sp)
108 | add $t2,$t1,$t0
109 | sw $t2,32($sp)
110 | lw $t0,32($sp)
111 | sw $t0,8($sp)
112 | li $t0,13
113 | sw $t0,40($sp)
114 | li $t0,-79
115 | sw $t0,44($sp)
116 | lw $t0,40($sp)
117 | lw $t1,44($sp)
118 | mult $t0,$t1
119 | mflo $t2
120 | sw $t2,40($sp)
121 | lw $t0,40($sp)
122 | sw $t0,12($sp)
123 | li $t0,79
124 | sw $t0,48($sp)
125 | li $t0,-13
126 | sw $t0,52($sp)
127 | lw $t0,48($sp)
128 | lw $t1,52($sp)
129 | div $t0,$t1
130 | mflo $t2
131 | sw $t2,48($sp)
132 | lw $t0,48($sp)
133 | sw $t0,16($sp)
134 | li $t0,1079
135 | sw $t0,56($sp)
136 | li $t0,18
137 | sw $t0,60($sp)
138 | lw $t0,56($sp)
139 | lw $t1,60($sp)
140 | mult $t0,$t1
141 | mflo $t2
142 | sw $t2,56($sp)
143 | li $t0,24
144 | sw $t0,64($sp)
145 | li $t0,5
146 | sw $t0,68($sp)
147 | lw $t0,64($sp)
148 | lw $t1,68($sp)
149 | mult $t0,$t1
150 | mflo $t2
151 | sw $t2,64($sp)
152 | lw $t0,56($sp)
153 | lw $t1,64($sp)
154 | sub $t2,$t0,$t1
155 | sw $t2,56($sp)
156 | li $t0,9
157 | sw $t0,72($sp)
158 | li $t0,-2
159 | sw $t0,76($sp)
160 | lw $t0,72($sp)
161 | lw $t1,76($sp)
162 | div $t0,$t1
163 | mflo $t2
164 | sw $t2,72($sp)
165 | lw $t0,56($sp)
166 | lw $t1,72($sp)
167 | add $t2,$t1,$t0
168 | sw $t2,56($sp)
169 | lw $t0,56($sp)
170 | sw $t0,20($sp)
171 | lw $t0,4($sp)
172 | sw $t0,80($sp)
173 | li $v0, 1
174 | lw $a0,80($sp)
175 | syscall
176 | li $v0, 4
177 | la $a0,$enter
178 | syscall
179 | lw $t0,8($sp)
180 | sw $t0,84($sp)
181 | li $v0, 1
182 | lw $a0,84($sp)
183 | syscall
184 | li $v0, 4
185 | la $a0,$enter
186 | syscall
187 | lw $t0,12($sp)
188 | sw $t0,88($sp)
189 | li $v0, 1
190 | lw $a0,88($sp)
191 | syscall
192 | li $v0, 4
193 | la $a0,$enter
194 | syscall
195 | lw $t0,16($sp)
196 | sw $t0,92($sp)
197 | li $v0, 1
198 | lw $a0,92($sp)
199 | syscall
200 | li $v0, 4
201 | la $a0,$enter
202 | syscall
203 | lw $t0,20($sp)
204 | sw $t0,96($sp)
205 | li $v0, 1
206 | lw $a0,96($sp)
207 | syscall
208 | li $v0, 4
209 | la $a0,$enter
210 | syscall
211 | lw $v0,336($sp)
212 | lw $ra, 0($sp)
213 | addi $sp, $sp,100
214 | jr $ra
215 | lw $ra,0($sp)
216 | addi $sp,$sp,100
217 | jr $ra
218 | returnq:
219 | subi $sp, $sp,8
220 | sw $ra,0($sp)
221 | li $t0,81
222 | sw $t0,4($sp)
223 | lw $v0,4($sp)
224 | lw $ra, 0($sp)
225 | addi $sp, $sp,8
226 | jr $ra
227 | whiletest:
228 | subi $sp, $sp,32
229 | sw $ra,0($sp)
230 | li $t0,0
231 | sw $t0,8($sp)
232 | lw $t0,8($sp)
233 | sw $t0,4($sp)
234 | Lab1:
235 | lw $t0,4($sp)
236 | sw $t0,12($sp)
237 | li $t0,10
238 | sw $t0,16($sp)
239 | lw $t0,12($sp)
240 | lw $t1,16($sp)
241 | bge $t0,$t1,Lab0
242 | lw $t0,4($sp)
243 | sw $t0,20($sp)
244 | li $t0,1
245 | sw $t0,24($sp)
246 | lw $t0,20($sp)
247 | lw $t1,24($sp)
248 | add $t2,$t1,$t0
249 | sw $t2,20($sp)
250 | lw $t0,20($sp)
251 | sw $t0,4($sp)
252 | lw $t0,4($sp)
253 | sw $t0,28($sp)
254 | li $v0, 4
255 | la $a0,$string0
256 | syscall
257 | li $v0, 1
258 | lw $a0,28($sp)
259 | syscall
260 | li $v0, 4
261 | la $a0,$enter
262 | syscall
263 | j Lab1
264 | Lab0:
265 | lw $v0,336($sp)
266 | lw $ra, 0($sp)
267 | addi $sp, $sp,32
268 | jr $ra
269 | lw $ra,0($sp)
270 | addi $sp,$sp,32
271 | jr $ra
272 | switchtest:
273 | subi $sp, $sp,40
274 | sw $ra,0($sp)
275 | lw $t0,4($sp)
276 | sw $t0,8($sp)
277 | li $t0,1
278 | sw $t0,12($sp)
279 | lw $t0,8($sp)
280 | lw $t1,12($sp)
281 | bne $t0,$t1,Lab3
282 | li $v0, 4
283 | la $a0,$string1
284 | syscall
285 | la $a0,$enter
286 | syscall
287 | j Lab2
288 | Lab3:
289 | li $t0,2
290 | sw $t0,16($sp)
291 | lw $t0,8($sp)
292 | lw $t1,16($sp)
293 | bne $t0,$t1,Lab4
294 | li $v0, 4
295 | la $a0,$string2
296 | syscall
297 | la $a0,$enter
298 | syscall
299 | li $t0,50
300 | sw $t0,20($sp)
301 | lw $v0,20($sp)
302 | lw $ra, 0($sp)
303 | addi $sp, $sp,40
304 | jr $ra
305 | j Lab2
306 | Lab4:
307 | li $t0,3
308 | sw $t0,24($sp)
309 | lw $t0,8($sp)
310 | lw $t1,24($sp)
311 | bne $t0,$t1,Lab5
312 | jal whiletest
313 | sw $v0,28($sp)
314 | li $t0,233
315 | sw $t0,32($sp)
316 | lw $v0,32($sp)
317 | lw $ra, 0($sp)
318 | addi $sp, $sp,40
319 | jr $ra
320 | j Lab2
321 | Lab5:
322 | li $v0, 4
323 | la $a0,$string3
324 | syscall
325 | la $a0,$enter
326 | syscall
327 | Lab2:
328 | li $t0,0
329 | sw $t0,36($sp)
330 | lw $v0,36($sp)
331 | lw $ra, 0($sp)
332 | addi $sp, $sp,40
333 | jr $ra
334 | relationcover:
335 | subi $sp, $sp,464
336 | sw $ra,0($sp)
337 | lw $t0,4($sp)
338 | sw $t0,20($sp)
339 | li $t0,97
340 | sw $t0,24($sp)
341 | lw $t0,20($sp)
342 | lw $t1,24($sp)
343 | bne $t0,$t1,Lab6
344 | li $t0,0
345 | sw $t0,28($sp)
346 | lw $t0,28($sp)
347 | sw $t0,12($sp)
348 | li $t0,97
349 | sw $t0,32($sp)
350 | lw $t0,32($sp)
351 | sw $t0,8($sp)
352 | li $t0,97
353 | sw $t0,36($sp)
354 | lw $t0,36($sp)
355 | sw $t0,16($sp)
356 | lw $t0,8($sp)
357 | sw $t0,40($sp)
358 | lw $t0,4($sp)
359 | sw $t0,44($sp)
360 | lw $t0,40($sp)
361 | lw $t1,44($sp)
362 | bne $t0,$t1,Lab7
363 | li $v0, 4
364 | la $a0,$string4
365 | syscall
366 | la $a0,$enter
367 | syscall
368 | lw $t0,12($sp)
369 | sw $t0,48($sp)
370 | li $t0,1
371 | sw $t0,52($sp)
372 | lw $t0,48($sp)
373 | lw $t1,52($sp)
374 | add $t2,$t1,$t0
375 | sw $t2,48($sp)
376 | lw $t0,48($sp)
377 | sw $t0,12($sp)
378 | Lab7:
379 | lw $t0,16($sp)
380 | sw $t0,56($sp)
381 | lw $t0,4($sp)
382 | sw $t0,60($sp)
383 | lw $t0,56($sp)
384 | lw $t1,60($sp)
385 | bne $t0,$t1,Lab8
386 | li $v0, 4
387 | la $a0,$string5
388 | syscall
389 | la $a0,$enter
390 | syscall
391 | lw $t0,12($sp)
392 | sw $t0,64($sp)
393 | li $t0,1
394 | sw $t0,68($sp)
395 | lw $t0,64($sp)
396 | lw $t1,68($sp)
397 | add $t2,$t1,$t0
398 | sw $t2,64($sp)
399 | lw $t0,64($sp)
400 | sw $t0,12($sp)
401 | Lab8:
402 | lw $t0,12($sp)
403 | sw $t0,72($sp)
404 | li $t0,2
405 | sw $t0,76($sp)
406 | lw $t0,72($sp)
407 | lw $t1,76($sp)
408 | bne $t0,$t1,Lab9
409 | li $v0, 4
410 | la $a0,$string6
411 | syscall
412 | la $a0,$enter
413 | syscall
414 | Lab9:
415 | li $t0,111
416 | sw $t0,80($sp)
417 | lw $t0,80($sp)
418 | sw $t0,8($sp)
419 | Lab6:
420 | lw $t0,8($sp)
421 | sw $t0,84($sp)
422 | li $t0,110
423 | sw $t0,88($sp)
424 | lw $t0,84($sp)
425 | lw $t1,88($sp)
426 | beq $t0,$t1,Lab10
427 | li $t0,0
428 | sw $t0,92($sp)
429 | lw $t0,92($sp)
430 | sw $t0,12($sp)
431 | lw $t0,4($sp)
432 | sw $t0,96($sp)
433 | lw $t0,16($sp)
434 | sw $t0,100($sp)
435 | lw $t0,96($sp)
436 | lw $t1,100($sp)
437 | beq $t0,$t1,Lab11
438 | lw $t0,12($sp)
439 | sw $t0,104($sp)
440 | li $t0,1
441 | sw $t0,108($sp)
442 | lw $t0,104($sp)
443 | lw $t1,108($sp)
444 | add $t2,$t1,$t0
445 | sw $t2,104($sp)
446 | lw $t0,104($sp)
447 | sw $t0,12($sp)
448 | li $v0, 4
449 | la $a0,$string7
450 | syscall
451 | la $a0,$enter
452 | syscall
453 | Lab11:
454 | lw $t0,8($sp)
455 | sw $t0,112($sp)
456 | li $t0,111
457 | sw $t0,116($sp)
458 | lw $t0,112($sp)
459 | lw $t1,116($sp)
460 | beq $t0,$t1,Lab12
461 | lw $t0,12($sp)
462 | sw $t0,120($sp)
463 | li $t0,1
464 | sw $t0,124($sp)
465 | lw $t0,120($sp)
466 | lw $t1,124($sp)
467 | add $t2,$t1,$t0
468 | sw $t2,120($sp)
469 | lw $t0,120($sp)
470 | sw $t0,12($sp)
471 | li $v0, 4
472 | la $a0,$string8
473 | syscall
474 | la $a0,$enter
475 | syscall
476 | Lab12:
477 | lw $t0,8($sp)
478 | sw $t0,128($sp)
479 | lw $t0,4($sp)
480 | sw $t0,132($sp)
481 | lw $t0,128($sp)
482 | lw $t1,132($sp)
483 | beq $t0,$t1,Lab13
484 | lw $t0,12($sp)
485 | sw $t0,136($sp)
486 | li $t0,1
487 | sw $t0,140($sp)
488 | lw $t0,136($sp)
489 | lw $t1,140($sp)
490 | add $t2,$t1,$t0
491 | sw $t2,136($sp)
492 | lw $t0,136($sp)
493 | sw $t0,12($sp)
494 | li $v0, 4
495 | la $a0,$string9
496 | syscall
497 | la $a0,$enter
498 | syscall
499 | Lab13:
500 | lw $t0,12($sp)
501 | sw $t0,144($sp)
502 | li $t0,1
503 | sw $t0,148($sp)
504 | lw $t0,144($sp)
505 | lw $t1,148($sp)
506 | bne $t0,$t1,Lab14
507 | li $v0, 4
508 | la $a0,$string10
509 | syscall
510 | la $a0,$enter
511 | syscall
512 | Lab14:
513 | li $t0,100
514 | sw $t0,152($sp)
515 | lw $t0,152($sp)
516 | sw $t0,8($sp)
517 | Lab10:
518 | lw $t0,8($sp)
519 | sw $t0,156($sp)
520 | li $t0,99
521 | sw $t0,160($sp)
522 | lw $t0,156($sp)
523 | lw $t1,160($sp)
524 | ble $t0,$t1,Lab15
525 | li $t0,0
526 | sw $t0,164($sp)
527 | lw $t0,164($sp)
528 | sw $t0,12($sp)
529 | lw $t0,8($sp)
530 | sw $t0,168($sp)
531 | lw $t0,12($sp)
532 | sw $t0,172($sp)
533 | lw $t0,168($sp)
534 | lw $t1,172($sp)
535 | ble $t0,$t1,Lab16
536 | lw $t0,12($sp)
537 | sw $t0,176($sp)
538 | li $t0,1
539 | sw $t0,180($sp)
540 | lw $t0,176($sp)
541 | lw $t1,180($sp)
542 | add $t2,$t1,$t0
543 | sw $t2,176($sp)
544 | lw $t0,176($sp)
545 | sw $t0,12($sp)
546 | Lab16:
547 | lw $t0,8($sp)
548 | sw $t0,184($sp)
549 | lw $t0,4($sp)
550 | sw $t0,188($sp)
551 | lw $t0,184($sp)
552 | lw $t1,188($sp)
553 | ble $t0,$t1,Lab17
554 | lw $t0,12($sp)
555 | sw $t0,192($sp)
556 | li $t0,1
557 | sw $t0,196($sp)
558 | lw $t0,192($sp)
559 | lw $t1,196($sp)
560 | add $t2,$t1,$t0
561 | sw $t2,192($sp)
562 | lw $t0,192($sp)
563 | sw $t0,12($sp)
564 | Lab17:
565 | lw $t0,8($sp)
566 | sw $t0,200($sp)
567 | li $t0,99
568 | sw $t0,204($sp)
569 | lw $t0,200($sp)
570 | lw $t1,204($sp)
571 | ble $t0,$t1,Lab18
572 | lw $t0,8($sp)
573 | sw $t0,208($sp)
574 | li $t0,98
575 | sw $t0,212($sp)
576 | lw $t0,208($sp)
577 | lw $t1,212($sp)
578 | ble $t0,$t1,Lab19
579 | lw $t0,12($sp)
580 | sw $t0,216($sp)
581 | li $t0,1
582 | sw $t0,220($sp)
583 | lw $t0,216($sp)
584 | lw $t1,220($sp)
585 | add $t2,$t1,$t0
586 | sw $t2,216($sp)
587 | lw $t0,216($sp)
588 | sw $t0,12($sp)
589 | Lab19:
590 | Lab18:
591 | lw $t0,12($sp)
592 | sw $t0,224($sp)
593 | li $t0,3
594 | sw $t0,228($sp)
595 | lw $t0,224($sp)
596 | lw $t1,228($sp)
597 | bne $t0,$t1,Lab20
598 | li $v0, 4
599 | la $a0,$string11
600 | syscall
601 | la $a0,$enter
602 | syscall
603 | Lab20:
604 | li $t0,77
605 | sw $t0,232($sp)
606 | lw $t0,232($sp)
607 | sw $t0,8($sp)
608 | Lab15:
609 | lw $t0,8($sp)
610 | sw $t0,236($sp)
611 | li $t0,88
612 | sw $t0,240($sp)
613 | lw $t0,236($sp)
614 | lw $t1,240($sp)
615 | bge $t0,$t1,Lab21
616 | li $t0,0
617 | sw $t0,244($sp)
618 | lw $t0,244($sp)
619 | sw $t0,12($sp)
620 | lw $t0,8($sp)
621 | sw $t0,248($sp)
622 | lw $t0,4($sp)
623 | sw $t0,252($sp)
624 | lw $t0,248($sp)
625 | lw $t1,252($sp)
626 | bge $t0,$t1,Lab22
627 | lw $t0,12($sp)
628 | sw $t0,256($sp)
629 | li $t0,1
630 | sw $t0,260($sp)
631 | lw $t0,256($sp)
632 | lw $t1,260($sp)
633 | add $t2,$t1,$t0
634 | sw $t2,256($sp)
635 | lw $t0,256($sp)
636 | sw $t0,12($sp)
637 | Lab22:
638 | lw $t0,16($sp)
639 | sw $t0,264($sp)
640 | lw $t0,4($sp)
641 | sw $t0,268($sp)
642 | lw $t0,264($sp)
643 | lw $t1,268($sp)
644 | bge $t0,$t1,Lab23
645 | lw $t0,12($sp)
646 | sw $t0,272($sp)
647 | li $t0,1
648 | sw $t0,276($sp)
649 | lw $t0,272($sp)
650 | lw $t1,276($sp)
651 | add $t2,$t1,$t0
652 | sw $t2,272($sp)
653 | lw $t0,272($sp)
654 | sw $t0,12($sp)
655 | Lab23:
656 | lw $t0,12($sp)
657 | sw $t0,280($sp)
658 | lw $t0,8($sp)
659 | sw $t0,284($sp)
660 | lw $t0,280($sp)
661 | lw $t1,284($sp)
662 | bge $t0,$t1,Lab24
663 | lw $t0,12($sp)
664 | sw $t0,288($sp)
665 | li $t0,1
666 | sw $t0,292($sp)
667 | lw $t0,288($sp)
668 | lw $t1,292($sp)
669 | add $t2,$t1,$t0
670 | sw $t2,288($sp)
671 | lw $t0,288($sp)
672 | sw $t0,12($sp)
673 | Lab24:
674 | lw $t0,12($sp)
675 | sw $t0,296($sp)
676 | li $t0,2
677 | sw $t0,300($sp)
678 | lw $t0,296($sp)
679 | lw $t1,300($sp)
680 | bne $t0,$t1,Lab25
681 | li $v0, 4
682 | la $a0,$string12
683 | syscall
684 | la $a0,$enter
685 | syscall
686 | Lab25:
687 | Lab21:
688 | lw $t0,8($sp)
689 | sw $t0,304($sp)
690 | li $t0,66
691 | sw $t0,308($sp)
692 | lw $t0,304($sp)
693 | lw $t1,308($sp)
694 | blt $t0,$t1,Lab26
695 | li $t0,0
696 | sw $t0,312($sp)
697 | lw $t0,312($sp)
698 | sw $t0,12($sp)
699 | lw $t0,8($sp)
700 | sw $t0,316($sp)
701 | li $t0,50
702 | sw $t0,320($sp)
703 | lw $t0,316($sp)
704 | lw $t1,320($sp)
705 | blt $t0,$t1,Lab27
706 | lw $t0,12($sp)
707 | sw $t0,324($sp)
708 | li $t0,1
709 | sw $t0,328($sp)
710 | lw $t0,324($sp)
711 | lw $t1,328($sp)
712 | add $t2,$t1,$t0
713 | sw $t2,324($sp)
714 | lw $t0,324($sp)
715 | sw $t0,12($sp)
716 | Lab27:
717 | lw $t0,8($sp)
718 | sw $t0,332($sp)
719 | lw $t0,4($sp)
720 | sw $t0,336($sp)
721 | lw $t0,332($sp)
722 | lw $t1,336($sp)
723 | blt $t0,$t1,Lab28
724 | lw $t0,12($sp)
725 | sw $t0,340($sp)
726 | li $t0,1
727 | sw $t0,344($sp)
728 | lw $t0,340($sp)
729 | lw $t1,344($sp)
730 | add $t2,$t1,$t0
731 | sw $t2,340($sp)
732 | lw $t0,340($sp)
733 | sw $t0,12($sp)
734 | Lab28:
735 | lw $t0,16($sp)
736 | sw $t0,348($sp)
737 | lw $t0,4($sp)
738 | sw $t0,352($sp)
739 | lw $t0,348($sp)
740 | lw $t1,352($sp)
741 | blt $t0,$t1,Lab29
742 | lw $t0,12($sp)
743 | sw $t0,356($sp)
744 | li $t0,1
745 | sw $t0,360($sp)
746 | lw $t0,356($sp)
747 | lw $t1,360($sp)
748 | add $t2,$t1,$t0
749 | sw $t2,356($sp)
750 | lw $t0,356($sp)
751 | sw $t0,12($sp)
752 | Lab29:
753 | lw $t0,12($sp)
754 | sw $t0,364($sp)
755 | li $t0,2
756 | sw $t0,368($sp)
757 | lw $t0,364($sp)
758 | lw $t1,368($sp)
759 | bne $t0,$t1,Lab30
760 | li $v0, 4
761 | la $a0,$string13
762 | syscall
763 | la $a0,$enter
764 | syscall
765 | Lab30:
766 | Lab26:
767 | lw $t0,8($sp)
768 | sw $t0,372($sp)
769 | li $t0,111
770 | sw $t0,376($sp)
771 | lw $t0,372($sp)
772 | lw $t1,376($sp)
773 | bgt $t0,$t1,Lab31
774 | li $t0,0
775 | sw $t0,380($sp)
776 | lw $t0,380($sp)
777 | sw $t0,12($sp)
778 | lw $t0,4($sp)
779 | sw $t0,384($sp)
780 | lw $t0,8($sp)
781 | sw $t0,388($sp)
782 | lw $t0,384($sp)
783 | lw $t1,388($sp)
784 | bgt $t0,$t1,Lab32
785 | lw $t0,12($sp)
786 | sw $t0,392($sp)
787 | li $t0,1
788 | sw $t0,396($sp)
789 | lw $t0,392($sp)
790 | lw $t1,396($sp)
791 | add $t2,$t1,$t0
792 | sw $t2,392($sp)
793 | lw $t0,392($sp)
794 | sw $t0,12($sp)
795 | Lab32:
796 | lw $t0,16($sp)
797 | sw $t0,400($sp)
798 | lw $t0,4($sp)
799 | sw $t0,404($sp)
800 | lw $t0,400($sp)
801 | lw $t1,404($sp)
802 | bgt $t0,$t1,Lab33
803 | lw $t0,12($sp)
804 | sw $t0,408($sp)
805 | li $t0,1
806 | sw $t0,412($sp)
807 | lw $t0,408($sp)
808 | lw $t1,412($sp)
809 | add $t2,$t1,$t0
810 | sw $t2,408($sp)
811 | lw $t0,408($sp)
812 | sw $t0,12($sp)
813 | Lab33:
814 | lw $t0,8($sp)
815 | sw $t0,416($sp)
816 | li $t0,1000
817 | sw $t0,420($sp)
818 | lw $t0,416($sp)
819 | lw $t1,420($sp)
820 | bgt $t0,$t1,Lab34
821 | lw $t0,12($sp)
822 | sw $t0,424($sp)
823 | li $t0,1
824 | sw $t0,428($sp)
825 | lw $t0,424($sp)
826 | lw $t1,428($sp)
827 | add $t2,$t1,$t0
828 | sw $t2,424($sp)
829 | lw $t0,424($sp)
830 | sw $t0,12($sp)
831 | Lab34:
832 | lw $t0,12($sp)
833 | sw $t0,432($sp)
834 | li $t0,2
835 | sw $t0,436($sp)
836 | lw $t0,432($sp)
837 | lw $t1,436($sp)
838 | bne $t0,$t1,Lab35
839 | li $v0, 4
840 | la $a0,$string14
841 | syscall
842 | la $a0,$enter
843 | syscall
844 | Lab35:
845 | li $t0,1
846 | sw $t0,440($sp)
847 | lw $t0,440($sp)
848 | sw $t0,12($sp)
849 | Lab31:
850 | lw $t0,12($sp)
851 | sw $t0,444($sp)
852 | lw $t0,444($sp)
853 | lw $t1,336($sp)
854 | beq $t0,$0,Lab36
855 | lw $t0,8($sp)
856 | sw $t0,448($sp)
857 | li $v0, 4
858 | la $a0,$string15
859 | syscall
860 | li $v0, 1
861 | lw $a0,448($sp)
862 | syscall
863 | li $v0, 4
864 | la $a0,$enter
865 | syscall
866 | Lab36:
867 | li $t0,0
868 | sw $t0,452($sp)
869 | lw $t0,452($sp)
870 | sw $t0,12($sp)
871 | lw $t0,12($sp)
872 | sw $t0,456($sp)
873 | lw $t0,456($sp)
874 | lw $t1,336($sp)
875 | beq $t0,$0,Lab37
876 | li $v0, 4
877 | la $a0,$string16
878 | syscall
879 | la $a0,$enter
880 | syscall
881 | Lab37:
882 | lw $t0,4($sp)
883 | sw $t0,460($sp)
884 | lw $v0,460($sp)
885 | lw $ra, 0($sp)
886 | addi $sp, $sp,464
887 | jr $ra
888 | f:
889 | subi $sp, $sp,64
890 | sw $ra,0($sp)
891 | lw $t0,4($sp)
892 | sw $t0,8($sp)
893 | li $t0,0
894 | sw $t0,12($sp)
895 | lw $t0,8($sp)
896 | lw $t1,12($sp)
897 | bgt $t0,$t1,Lab38
898 | li $v0, 4
899 | la $a0,$string17
900 | syscall
901 | la $a0,$enter
902 | syscall
903 | lw $v0,336($sp)
904 | lw $ra, 0($sp)
905 | addi $sp, $sp,64
906 | jr $ra
907 | Lab38:
908 | lw $t0,4($sp)
909 | sw $t0,16($sp)
910 | li $t0,1
911 | sw $t0,20($sp)
912 | lw $t0,16($sp)
913 | lw $t1,20($sp)
914 | bne $t0,$t1,Lab39
915 | li $t0,1
916 | sw $t0,24($sp)
917 | lw $v0,24($sp)
918 | lw $ra, 0($sp)
919 | addi $sp, $sp,64
920 | jr $ra
921 | Lab39:
922 | lw $t0,4($sp)
923 | sw $t0,28($sp)
924 | li $t0,2
925 | sw $t0,32($sp)
926 | lw $t0,28($sp)
927 | lw $t1,32($sp)
928 | bne $t0,$t1,Lab40
929 | li $t0,1
930 | sw $t0,36($sp)
931 | lw $v0,36($sp)
932 | lw $ra, 0($sp)
933 | addi $sp, $sp,64
934 | jr $ra
935 | Lab40:
936 | lw $t0,4($sp)
937 | sw $t0,44($sp)
938 | li $t0,1
939 | sw $t0,48($sp)
940 | lw $t0,44($sp)
941 | lw $t1,48($sp)
942 | sub $t2,$t0,$t1
943 | sw $t2,44($sp)
944 | lw $t1,44($sp)
945 | subi $sp,$sp,64
946 | sw $t1,4($sp)
947 | addi $sp,$sp,64
948 | jal f
949 | sw $v0,40($sp)
950 | lw $t0,4($sp)
951 | sw $t0,56($sp)
952 | li $t0,2
953 | sw $t0,60($sp)
954 | lw $t0,56($sp)
955 | lw $t1,60($sp)
956 | sub $t2,$t0,$t1
957 | sw $t2,56($sp)
958 | lw $t1,56($sp)
959 | subi $sp,$sp,64
960 | sw $t1,4($sp)
961 | addi $sp,$sp,64
962 | jal f
963 | sw $v0,52($sp)
964 | lw $t0,40($sp)
965 | lw $t1,52($sp)
966 | add $t2,$t1,$t0
967 | sw $t2,40($sp)
968 | lw $v0,40($sp)
969 | lw $ra, 0($sp)
970 | addi $sp, $sp,64
971 | jr $ra
972 | main:
973 | subi $sp, $sp,340
974 | sw $ra,0($sp)
975 | li $v0, 4
976 | la $a0,$string18
977 | syscall
978 | la $a0,$enter
979 | syscall
980 | li $t0,15
981 | sw $t0,64($sp)
982 | lw $t1,64($sp)
983 | subi $sp,$sp,20
984 | sw $t1,4($sp)
985 | addi $sp,$sp,20
986 | jal tempadd
987 | sw $v0,60($sp)
988 | jal caltest
989 | sw $v0,68($sp)
990 | li $v0, 4
991 | la $a0,$string19
992 | syscall
993 | la $a0,$enter
994 | syscall
995 | li $v0, 4
996 | la $a0,$string20
997 | syscall
998 | la $a0,$enter
999 | syscall
1000 | la $t0,ca
1001 | lw $t1,0($t0)
1002 | sw $t1,72($sp)
1003 | li $v0, 4
1004 | la $a0,$string21
1005 | syscall
1006 | li $v0, 1
1007 | lw $a0,72($sp)
1008 | syscall
1009 | li $v0, 4
1010 | la $a0,$enter
1011 | syscall
1012 | la $t0,cb
1013 | lw $t1,0($t0)
1014 | sw $t1,76($sp)
1015 | li $v0, 1
1016 | lw $a0,76($sp)
1017 | syscall
1018 | li $v0, 4
1019 | la $a0,$enter
1020 | syscall
1021 | li $v0, 4
1022 | la $a0,$string22
1023 | syscall
1024 | la $a0,$enter
1025 | syscall
1026 | li $t0,10
1027 | sw $t0,80($sp)
1028 | lw $t0,80($sp)
1029 | sw $t0,4($sp)
1030 | la $t0,CA
1031 | lw $t1,0($t0)
1032 | sw $t1,84($sp)
1033 | lw $t0,84($sp)
1034 | la $t1,va
1035 | sw $t0,0($t1)
1036 | li $t0,0
1037 | sw $t0,88($sp)
1038 | li $t0,233
1039 | sw $t0,92($sp)
1040 | la $t0,arr
1041 | lw $t1,88($sp)
1042 | mul $t1,$t1,4
1043 | add $t0,$t0,$t1
1044 | lw $v0,92($sp)
1045 | sw $v0,0($t0)
1046 | li $t0,1
1047 | sw $t0,96($sp)
1048 | li $t0,81
1049 | sw $t0,100($sp)
1050 | la $t0,charr
1051 | lw $t1,96($sp)
1052 | mul $t1,$t1,4
1053 | add $t0,$t0,$t1
1054 | lw $v0,100($sp)
1055 | sw $v0,0($t0)
1056 | li $t0,3
1057 | sw $t0,104($sp)
1058 | li $t0,43
1059 | sw $t0,108($sp)
1060 | lw $t0,104($sp)
1061 | mul $t0,$t0,4
1062 | addi $t0,$t0,36
1063 | add $t0,$t0,$sp
1064 | lw $v0,108($sp)
1065 | sw $v0,0($t0)
1066 | li $t0,1
1067 | sw $t0,116($sp)
1068 | la $t0,charr
1069 | lw $t1,116($sp)
1070 | mul $t1,$t1,4
1071 | add $t1,$t1,$t0
1072 | lw $t0,0($t1)
1073 | sw $t0,112($sp)
1074 | lw $t0,112($sp)
1075 | la $t1,vb
1076 | sw $t0,0($t1)
1077 | la $t0,va
1078 | lw $t1,0($t0)
1079 | sw $t1,120($sp)
1080 | li $v0, 1
1081 | lw $a0,120($sp)
1082 | syscall
1083 | li $v0, 4
1084 | la $a0,$enter
1085 | syscall
1086 | li $t0,0
1087 | sw $t0,128($sp)
1088 | la $t0,arr
1089 | lw $t1,128($sp)
1090 | mul $t1,$t1,4
1091 | add $t1,$t1,$t0
1092 | lw $t0,0($t1)
1093 | sw $t0,124($sp)
1094 | li $v0, 1
1095 | lw $a0,124($sp)
1096 | syscall
1097 | li $v0, 4
1098 | la $a0,$enter
1099 | syscall
1100 | li $t0,1
1101 | sw $t0,136($sp)
1102 | la $t0,charr
1103 | lw $t1,136($sp)
1104 | mul $t1,$t1,4
1105 | add $t1,$t1,$t0
1106 | lw $t0,0($t1)
1107 | sw $t0,132($sp)
1108 | li $v0, 11
1109 | lw $a0,132($sp)
1110 | syscall
1111 | li $v0, 4
1112 | la $a0,$enter
1113 | syscall
1114 | li $t0,3
1115 | sw $t0,144($sp)
1116 | lw $t1,144($sp)
1117 | mul $t1,$t1,4
1118 | addi $t1,$t1,36
1119 | add $t1,$t1,$sp
1120 | lw $t0,0($t1)
1121 | sw $t0,140($sp)
1122 | li $v0, 11
1123 | lw $a0,140($sp)
1124 | syscall
1125 | li $v0, 4
1126 | la $a0,$enter
1127 | syscall
1128 | la $t0,vb
1129 | lw $t1,0($t0)
1130 | sw $t1,148($sp)
1131 | li $v0, 11
1132 | lw $a0,148($sp)
1133 | syscall
1134 | li $v0, 4
1135 | la $a0,$enter
1136 | syscall
1137 | la $t0,ce
1138 | lw $t1,0($t0)
1139 | sw $t1,152($sp)
1140 | li $v0, 4
1141 | la $a0,$string23
1142 | syscall
1143 | li $v0, 11
1144 | lw $a0,152($sp)
1145 | syscall
1146 | li $v0, 4
1147 | la $a0,$enter
1148 | syscall
1149 | la $t0,cc
1150 | lw $t1,0($t0)
1151 | sw $t1,156($sp)
1152 | li $v0, 11
1153 | lw $a0,156($sp)
1154 | syscall
1155 | li $v0, 4
1156 | la $a0,$enter
1157 | syscall
1158 | jal returnq
1159 | sw $v0,160($sp)
1160 | li $v0, 11
1161 | lw $a0,160($sp)
1162 | syscall
1163 | li $v0, 4
1164 | la $a0,$enter
1165 | syscall
1166 | li $v0, 4
1167 | la $a0,$string24
1168 | syscall
1169 | la $a0,$enter
1170 | syscall
1171 | la $t0,ca
1172 | lw $t1,0($t0)
1173 | sw $t1,164($sp)
1174 | la $t0,cb
1175 | lw $t1,0($t0)
1176 | sw $t1,168($sp)
1177 | lw $t0,164($sp)
1178 | lw $t1,168($sp)
1179 | add $t2,$t1,$t0
1180 | sw $t2,164($sp)
1181 | li $v0, 1
1182 | lw $a0,164($sp)
1183 | syscall
1184 | li $v0, 4
1185 | la $a0,$enter
1186 | syscall
1187 | la $t0,ch
1188 | lw $t1,0($t0)
1189 | sw $t1,172($sp)
1190 | la $t0,ch
1191 | lw $t1,0($t0)
1192 | sw $t1,176($sp)
1193 | lw $t0,172($sp)
1194 | lw $t1,176($sp)
1195 | add $t2,$t1,$t0
1196 | sw $t2,172($sp)
1197 | li $v0, 11
1198 | lw $a0,172($sp)
1199 | syscall
1200 | li $v0, 4
1201 | la $a0,$enter
1202 | syscall
1203 | la $t0,ch
1204 | lw $t1,0($t0)
1205 | sw $t1,180($sp)
1206 | la $t0,CG
1207 | lw $t1,0($t0)
1208 | sw $t1,184($sp)
1209 | lw $t0,180($sp)
1210 | lw $t1,184($sp)
1211 | add $t2,$t1,$t0
1212 | sw $t2,180($sp)
1213 | li $v0, 11
1214 | lw $a0,180($sp)
1215 | syscall
1216 | li $v0, 4
1217 | la $a0,$enter
1218 | syscall
1219 | la $t0,ca
1220 | lw $t1,0($t0)
1221 | sw $t1,188($sp)
1222 | la $t0,cb
1223 | lw $t1,0($t0)
1224 | sw $t1,192($sp)
1225 | lw $t0,188($sp)
1226 | lw $t1,192($sp)
1227 | add $t2,$t1,$t0
1228 | sw $t2,188($sp)
1229 | li $v0, 1
1230 | lw $a0,188($sp)
1231 | syscall
1232 | li $v0, 4
1233 | la $a0,$enter
1234 | syscall
1235 | li $v0, 4
1236 | la $a0,$string25
1237 | syscall
1238 | la $a0,$enter
1239 | syscall
1240 | lw $t0,4($sp)
1241 | sw $t0,196($sp)
1242 | li $t0,0
1243 | sw $t0,200($sp)
1244 | lw $t0,196($sp)
1245 | lw $t1,200($sp)
1246 | bne $t0,$t1,Lab41
1247 | li $v0, 4
1248 | la $a0,$string26
1249 | syscall
1250 | la $a0,$enter
1251 | syscall
1252 | Lab41:
1253 | lw $t0,4($sp)
1254 | sw $t0,204($sp)
1255 | li $t0,10
1256 | sw $t0,208($sp)
1257 | lw $t0,204($sp)
1258 | lw $t1,208($sp)
1259 | bne $t0,$t1,Lab42
1260 | li $v0, 4
1261 | la $a0,$string27
1262 | syscall
1263 | la $a0,$enter
1264 | syscall
1265 | Lab42:
1266 | la $t0,CA
1267 | lw $t1,0($t0)
1268 | sw $t1,212($sp)
1269 | la $t0,ca
1270 | lw $t1,0($t0)
1271 | sw $t1,216($sp)
1272 | lw $t0,212($sp)
1273 | lw $t1,216($sp)
1274 | bne $t0,$t1,Lab43
1275 | li $v0, 4
1276 | la $a0,$string28
1277 | syscall
1278 | la $a0,$enter
1279 | syscall
1280 | Lab43:
1281 | la $t0,ca
1282 | lw $t1,0($t0)
1283 | sw $t1,220($sp)
1284 | la $t0,CA
1285 | lw $t1,0($t0)
1286 | sw $t1,224($sp)
1287 | lw $t0,220($sp)
1288 | lw $t1,224($sp)
1289 | beq $t0,$t1,Lab44
1290 | li $v0, 4
1291 | la $a0,$string29
1292 | syscall
1293 | la $a0,$enter
1294 | syscall
1295 | Lab44:
1296 | li $v0, 4
1297 | la $a0,$string30
1298 | syscall
1299 | la $a0,$enter
1300 | syscall
1301 | li $v0,5
1302 | syscall
1303 | sw $v0,8($sp)
1304 | li $v0,12
1305 | syscall
1306 | sw $v0,24($sp)
1307 | li $v0,5
1308 | syscall
1309 | la $t0,vc
1310 | sw $v0,0($t0)
1311 | li $v0, 4
1312 | la $a0,$string31
1313 | syscall
1314 | la $a0,$enter
1315 | syscall
1316 | lw $t0,8($sp)
1317 | sw $t0,228($sp)
1318 | li $v0, 4
1319 | la $a0,$string32
1320 | syscall
1321 | li $v0, 1
1322 | lw $a0,228($sp)
1323 | syscall
1324 | li $v0, 4
1325 | la $a0,$enter
1326 | syscall
1327 | lw $t0,24($sp)
1328 | sw $t0,232($sp)
1329 | li $v0, 4
1330 | la $a0,$string33
1331 | syscall
1332 | li $v0, 11
1333 | lw $a0,232($sp)
1334 | syscall
1335 | li $v0, 4
1336 | la $a0,$enter
1337 | syscall
1338 | la $t0,vc
1339 | lw $t1,0($t0)
1340 | sw $t1,236($sp)
1341 | li $v0, 4
1342 | la $a0,$string34
1343 | syscall
1344 | li $v0, 1
1345 | lw $a0,236($sp)
1346 | syscall
1347 | li $v0, 4
1348 | la $a0,$enter
1349 | syscall
1350 | li $v0, 4
1351 | la $a0,$string35
1352 | syscall
1353 | la $a0,$enter
1354 | syscall
1355 | jal whiletest
1356 | sw $v0,240($sp)
1357 | li $v0, 4
1358 | la $a0,$string36
1359 | syscall
1360 | la $a0,$enter
1361 | syscall
1362 | li $t0,1
1363 | sw $t0,244($sp)
1364 | lw $t0,244($sp)
1365 | sw $t0,20($sp)
1366 | lw $t0,20($sp)
1367 | sw $t0,252($sp)
1368 | lw $t1,252($sp)
1369 | subi $sp,$sp,40
1370 | sw $t1,4($sp)
1371 | addi $sp,$sp,40
1372 | jal switchtest
1373 | sw $v0,248($sp)
1374 | lw $t0,248($sp)
1375 | sw $t0,16($sp)
1376 | lw $t0,16($sp)
1377 | sw $t0,256($sp)
1378 | li $v0, 4
1379 | la $a0,$string37
1380 | syscall
1381 | li $v0, 1
1382 | lw $a0,256($sp)
1383 | syscall
1384 | li $v0, 4
1385 | la $a0,$enter
1386 | syscall
1387 | li $t0,2
1388 | sw $t0,260($sp)
1389 | lw $t0,260($sp)
1390 | sw $t0,20($sp)
1391 | lw $t0,20($sp)
1392 | sw $t0,268($sp)
1393 | lw $t1,268($sp)
1394 | subi $sp,$sp,40
1395 | sw $t1,4($sp)
1396 | addi $sp,$sp,40
1397 | jal switchtest
1398 | sw $v0,264($sp)
1399 | lw $t0,264($sp)
1400 | sw $t0,16($sp)
1401 | lw $t0,16($sp)
1402 | sw $t0,272($sp)
1403 | li $v0, 4
1404 | la $a0,$string37
1405 | syscall
1406 | li $v0, 1
1407 | lw $a0,272($sp)
1408 | syscall
1409 | li $v0, 4
1410 | la $a0,$enter
1411 | syscall
1412 | li $t0,3
1413 | sw $t0,276($sp)
1414 | lw $t0,276($sp)
1415 | sw $t0,20($sp)
1416 | lw $t0,20($sp)
1417 | sw $t0,284($sp)
1418 | lw $t1,284($sp)
1419 | subi $sp,$sp,40
1420 | sw $t1,4($sp)
1421 | addi $sp,$sp,40
1422 | jal switchtest
1423 | sw $v0,280($sp)
1424 | lw $t0,280($sp)
1425 | sw $t0,16($sp)
1426 | lw $t0,16($sp)
1427 | sw $t0,288($sp)
1428 | li $v0, 4
1429 | la $a0,$string37
1430 | syscall
1431 | li $v0, 1
1432 | lw $a0,288($sp)
1433 | syscall
1434 | li $v0, 4
1435 | la $a0,$enter
1436 | syscall
1437 | li $t0,4
1438 | sw $t0,292($sp)
1439 | lw $t0,292($sp)
1440 | sw $t0,20($sp)
1441 | lw $t0,20($sp)
1442 | sw $t0,300($sp)
1443 | lw $t1,300($sp)
1444 | subi $sp,$sp,40
1445 | sw $t1,4($sp)
1446 | addi $sp,$sp,40
1447 | jal switchtest
1448 | sw $v0,296($sp)
1449 | lw $t0,296($sp)
1450 | sw $t0,16($sp)
1451 | lw $t0,16($sp)
1452 | sw $t0,304($sp)
1453 | li $v0, 4
1454 | la $a0,$string37
1455 | syscall
1456 | li $v0, 1
1457 | lw $a0,304($sp)
1458 | syscall
1459 | li $v0, 4
1460 | la $a0,$enter
1461 | syscall
1462 | li $v0, 4
1463 | la $a0,$string38
1464 | syscall
1465 | la $a0,$enter
1466 | syscall
1467 | li $t0,97
1468 | sw $t0,308($sp)
1469 | lw $t0,308($sp)
1470 | sw $t0,28($sp)
1471 | lw $t0,28($sp)
1472 | sw $t0,316($sp)
1473 | lw $t1,316($sp)
1474 | subi $sp,$sp,464
1475 | sw $t1,4($sp)
1476 | addi $sp,$sp,464
1477 | jal relationcover
1478 | sw $v0,312($sp)
1479 | lw $t0,312($sp)
1480 | sw $t0,32($sp)
1481 | lw $t0,32($sp)
1482 | sw $t0,320($sp)
1483 | li $v0, 11
1484 | lw $a0,320($sp)
1485 | syscall
1486 | li $v0, 4
1487 | la $a0,$enter
1488 | syscall
1489 | li $v0, 4
1490 | la $a0,$string39
1491 | syscall
1492 | la $a0,$enter
1493 | syscall
1494 | li $t0,20
1495 | sw $t0,324($sp)
1496 | lw $t0,324($sp)
1497 | sw $t0,20($sp)
1498 | lw $t0,20($sp)
1499 | sw $t0,332($sp)
1500 | lw $t1,332($sp)
1501 | subi $sp,$sp,64
1502 | sw $t1,4($sp)
1503 | addi $sp,$sp,64
1504 | jal f
1505 | sw $v0,328($sp)
1506 | lw $t0,328($sp)
1507 | sw $t0,12($sp)
1508 | lw $t0,12($sp)
1509 | sw $t0,336($sp)
1510 | li $v0, 1
1511 | lw $a0,336($sp)
1512 | syscall
1513 | li $v0, 4
1514 | la $a0,$enter
1515 | syscall
1516 |
--------------------------------------------------------------------------------
/C0-Compiler/C0-Compiler/13071079_test_mid.txt:
--------------------------------------------------------------------------------
1 | GLBSTR
2 | CON ca INT 2147483647
3 | CON cb INT -2147483648
4 | CON cg INT 0
5 | CON CA INT -15
6 | CON CB INT -20
7 | CON CG INT 9
8 | CON cc CHAR 97
9 | CON cd CHAR 43
10 | CON ce CHAR 42
11 | CON ch CHAR 48
12 | CON cf CHAR 95
13 | VAR va INT
14 | VAR vb CHAR
15 | VAR vc INT
16 | VAR vd INT
17 | ARR arr INT 10
18 | ARR charr CHAR 3
19 | GLBEND
20 | FUNC tempadd VOID
21 | LODV $temp0 w
22 | LODI $temp1 1
23 | + $temp0 $temp1 $temp0
24 | = w $value0 $temp0
25 | LODV $temp2 w
26 | PRT $temp2 1
27 | END
28 | FUNC caltest VOID
29 | VAR a INT
30 | VAR b INT
31 | VAR c INT
32 | VAR d INT
33 | VAR e INT
34 | LODI $temp3 13
35 | ~ $temp3
36 | LODI $temp4 79
37 | + $temp3 $temp4 $temp3
38 | = a $value0 $temp3
39 | LODI $temp5 13
40 | LODI $temp6 -97
41 | + $temp5 $temp6 $temp5
42 | = b $value0 $temp5
43 | LODI $temp7 13
44 | LODI $temp8 -79
45 | * $temp7 $temp8 $temp7
46 | = c $value0 $temp7
47 | LODI $temp9 79
48 | LODI $temp10 -13
49 | / $temp9 $temp10 $temp9
50 | = d $value0 $temp9
51 | LODI $temp11 1079
52 | LODI $temp12 18
53 | * $temp11 $temp12 $temp11
54 | LODI $temp13 24
55 | LODI $temp14 5
56 | * $temp13 $temp14 $temp13
57 | - $temp11 $temp13 $temp11
58 | LODI $temp15 9
59 | LODI $temp16 -2
60 | / $temp15 $temp16 $temp15
61 | + $temp11 $temp15 $temp11
62 | = e $value0 $temp11
63 | LODV $temp17 a
64 | PRT $temp17 1
65 | LODV $temp18 b
66 | PRT $temp18 1
67 | LODV $temp19 c
68 | PRT $temp19 1
69 | LODV $temp20 d
70 | PRT $temp20 1
71 | LODV $temp21 e
72 | PRT $temp21 1
73 | RET
74 | END
75 | FUNC returnq CHAR
76 | LODI $temp22 81
77 | RET $temp22
78 | FUNC whiletest VOID
79 | VAR i INT
80 | LODI $temp23 0
81 | = i $value0 $temp23
82 | LAB Lab1
83 | LODV $temp24 i
84 | LODI $temp25 10
85 | GTE $temp24 $temp25 Lab0
86 | LODV $temp26 i
87 | LODI $temp27 1
88 | + $temp26 $temp27 $temp26
89 | = i $value0 $temp26
90 | LODV $temp28 i
91 | PRT $string0 $temp28 2
92 | JMP Lab1
93 | LAB Lab0
94 | RET
95 | END
96 | FUNC switchtest INT
97 | LODV $temp29 a
98 | LODI $temp30 1
99 | NEQ $temp29 $temp30 Lab3
100 | PRT $string1 0
101 | JMP Lab2
102 | LAB Lab3
103 | LODI $temp31 2
104 | NEQ $temp29 $temp31 Lab4
105 | PRT $string2 0
106 | LODI $temp32 50
107 | RET $temp32
108 | JMP Lab2
109 | LAB Lab4
110 | LODI $temp33 3
111 | NEQ $temp29 $temp33 Lab5
112 | CALL whiletest
113 | LODR $temp34 $v0
114 | LODI $temp35 233
115 | RET $temp35
116 | JMP Lab2
117 | LAB Lab5
118 | PRT $string3 0
119 | LAB Lab2
120 | LODI $temp36 0
121 | RET $temp36
122 | FUNC relationcover CHAR
123 | VAR a INT
124 | VAR count INT
125 | VAR b CHAR
126 | LODV $temp37 c
127 | LODI $temp38 97
128 | NEQ $temp37 $temp38 Lab6
129 | LODI $temp39 0
130 | = count $value0 $temp39
131 | LODI $temp40 97
132 | = a $value0 $temp40
133 | LODI $temp41 97
134 | = b $value0 $temp41
135 | LODV $temp42 a
136 | LODV $temp43 c
137 | NEQ $temp42 $temp43 Lab7
138 | PRT $string4 0
139 | LODV $temp44 count
140 | LODI $temp45 1
141 | + $temp44 $temp45 $temp44
142 | = count $value0 $temp44
143 | LAB Lab7
144 | LODV $temp46 b
145 | LODV $temp47 c
146 | NEQ $temp46 $temp47 Lab8
147 | PRT $string5 0
148 | LODV $temp48 count
149 | LODI $temp49 1
150 | + $temp48 $temp49 $temp48
151 | = count $value0 $temp48
152 | LAB Lab8
153 | LODV $temp50 count
154 | LODI $temp51 2
155 | NEQ $temp50 $temp51 Lab9
156 | PRT $string6 0
157 | LAB Lab9
158 | LODI $temp52 111
159 | = a $value0 $temp52
160 | LAB Lab6
161 | LODV $temp53 a
162 | LODI $temp54 110
163 | EQU $temp53 $temp54 Lab10
164 | LODI $temp55 0
165 | = count $value0 $temp55
166 | LODV $temp56 c
167 | LODV $temp57 b
168 | EQU $temp56 $temp57 Lab11
169 | LODV $temp58 count
170 | LODI $temp59 1
171 | + $temp58 $temp59 $temp58
172 | = count $value0 $temp58
173 | PRT $string7 0
174 | LAB Lab11
175 | LODV $temp60 a
176 | LODI $temp61 111
177 | EQU $temp60 $temp61 Lab12
178 | LODV $temp62 count
179 | LODI $temp63 1
180 | + $temp62 $temp63 $temp62
181 | = count $value0 $temp62
182 | PRT $string8 0
183 | LAB Lab12
184 | LODV $temp64 a
185 | LODV $temp65 c
186 | EQU $temp64 $temp65 Lab13
187 | LODV $temp66 count
188 | LODI $temp67 1
189 | + $temp66 $temp67 $temp66
190 | = count $value0 $temp66
191 | PRT $string9 0
192 | LAB Lab13
193 | LODV $temp68 count
194 | LODI $temp69 1
195 | NEQ $temp68 $temp69 Lab14
196 | PRT $string10 0
197 | LAB Lab14
198 | LODI $temp70 100
199 | = a $value0 $temp70
200 | LAB Lab10
201 | LODV $temp71 a
202 | LODI $temp72 99
203 | LTE $temp71 $temp72 Lab15
204 | LODI $temp73 0
205 | = count $value0 $temp73
206 | LODV $temp74 a
207 | LODV $temp75 count
208 | LTE $temp74 $temp75 Lab16
209 | LODV $temp76 count
210 | LODI $temp77 1
211 | + $temp76 $temp77 $temp76
212 | = count $value0 $temp76
213 | LAB Lab16
214 | LODV $temp78 a
215 | LODV $temp79 c
216 | LTE $temp78 $temp79 Lab17
217 | LODV $temp80 count
218 | LODI $temp81 1
219 | + $temp80 $temp81 $temp80
220 | = count $value0 $temp80
221 | LAB Lab17
222 | LODV $temp82 a
223 | LODI $temp83 99
224 | LTE $temp82 $temp83 Lab18
225 | LODV $temp84 a
226 | LODI $temp85 98
227 | LTE $temp84 $temp85 Lab19
228 | LODV $temp86 count
229 | LODI $temp87 1
230 | + $temp86 $temp87 $temp86
231 | = count $value0 $temp86
232 | LAB Lab19
233 | LAB Lab18
234 | LODV $temp88 count
235 | LODI $temp89 3
236 | NEQ $temp88 $temp89 Lab20
237 | PRT $string11 0
238 | LAB Lab20
239 | LODI $temp90 77
240 | = a $value0 $temp90
241 | LAB Lab15
242 | LODV $temp91 a
243 | LODI $temp92 88
244 | GTE $temp91 $temp92 Lab21
245 | LODI $temp93 0
246 | = count $value0 $temp93
247 | LODV $temp94 a
248 | LODV $temp95 c
249 | GTE $temp94 $temp95 Lab22
250 | LODV $temp96 count
251 | LODI $temp97 1
252 | + $temp96 $temp97 $temp96
253 | = count $value0 $temp96
254 | LAB Lab22
255 | LODV $temp98 b
256 | LODV $temp99 c
257 | GTE $temp98 $temp99 Lab23
258 | LODV $temp100 count
259 | LODI $temp101 1
260 | + $temp100 $temp101 $temp100
261 | = count $value0 $temp100
262 | LAB Lab23
263 | LODV $temp102 count
264 | LODV $temp103 a
265 | GTE $temp102 $temp103 Lab24
266 | LODV $temp104 count
267 | LODI $temp105 1
268 | + $temp104 $temp105 $temp104
269 | = count $value0 $temp104
270 | LAB Lab24
271 | LODV $temp106 count
272 | LODI $temp107 2
273 | NEQ $temp106 $temp107 Lab25
274 | PRT $string12 0
275 | LAB Lab25
276 | LAB Lab21
277 | LODV $temp108 a
278 | LODI $temp109 66
279 | LESS $temp108 $temp109 Lab26
280 | LODI $temp110 0
281 | = count $value0 $temp110
282 | LODV $temp111 a
283 | LODI $temp112 50
284 | LESS $temp111 $temp112 Lab27
285 | LODV $temp113 count
286 | LODI $temp114 1
287 | + $temp113 $temp114 $temp113
288 | = count $value0 $temp113
289 | LAB Lab27
290 | LODV $temp115 a
291 | LODV $temp116 c
292 | LESS $temp115 $temp116 Lab28
293 | LODV $temp117 count
294 | LODI $temp118 1
295 | + $temp117 $temp118 $temp117
296 | = count $value0 $temp117
297 | LAB Lab28
298 | LODV $temp119 b
299 | LODV $temp120 c
300 | LESS $temp119 $temp120 Lab29
301 | LODV $temp121 count
302 | LODI $temp122 1
303 | + $temp121 $temp122 $temp121
304 | = count $value0 $temp121
305 | LAB Lab29
306 | LODV $temp123 count
307 | LODI $temp124 2
308 | NEQ $temp123 $temp124 Lab30
309 | PRT $string13 0
310 | LAB Lab30
311 | LAB Lab26
312 | LODV $temp125 a
313 | LODI $temp126 111
314 | GREAT $temp125 $temp126 Lab31
315 | LODI $temp127 0
316 | = count $value0 $temp127
317 | LODV $temp128 c
318 | LODV $temp129 a
319 | GREAT $temp128 $temp129 Lab32
320 | LODV $temp130 count
321 | LODI $temp131 1
322 | + $temp130 $temp131 $temp130
323 | = count $value0 $temp130
324 | LAB Lab32
325 | LODV $temp132 b
326 | LODV $temp133 c
327 | GREAT $temp132 $temp133 Lab33
328 | LODV $temp134 count
329 | LODI $temp135 1
330 | + $temp134 $temp135 $temp134
331 | = count $value0 $temp134
332 | LAB Lab33
333 | LODV $temp136 a
334 | LODI $temp137 1000
335 | GREAT $temp136 $temp137 Lab34
336 | LODV $temp138 count
337 | LODI $temp139 1
338 | + $temp138 $temp139 $temp138
339 | = count $value0 $temp138
340 | LAB Lab34
341 | LODV $temp140 count
342 | LODI $temp141 2
343 | NEQ $temp140 $temp141 Lab35
344 | PRT $string14 0
345 | LAB Lab35
346 | LODI $temp142 1
347 | = count $value0 $temp142
348 | LAB Lab31
349 | LODV $temp143 count
350 | EQU $temp143 $0 Lab36
351 | LODV $temp144 a
352 | PRT $string15 $temp144 2
353 | LAB Lab36
354 | LODI $temp145 0
355 | = count $value0 $temp145
356 | LODV $temp146 count
357 | EQU $temp146 $0 Lab37
358 | PRT $string16 0
359 | LAB Lab37
360 | LODV $temp147 c
361 | RET $temp147
362 | FUNC f INT
363 | LODV $temp148 n
364 | LODI $temp149 0
365 | GREAT $temp148 $temp149 Lab38
366 | PRT $string17 0
367 | RET
368 | LAB Lab38
369 | LODV $temp150 n
370 | LODI $temp151 1
371 | NEQ $temp150 $temp151 Lab39
372 | LODI $temp152 1
373 | RET $temp152
374 | LAB Lab39
375 | LODV $temp153 n
376 | LODI $temp154 2
377 | NEQ $temp153 $temp154 Lab40
378 | LODI $temp155 1
379 | RET $temp155
380 | LAB Lab40
381 | LODV $temp157 n
382 | LODI $temp158 1
383 | - $temp157 $temp158 $temp157
384 | PARA $temp157 1 f
385 | CALL f
386 | LODR $temp156 $v0
387 | LODV $temp160 n
388 | LODI $temp161 2
389 | - $temp160 $temp161 $temp160
390 | PARA $temp160 1 f
391 | CALL f
392 | LODR $temp159 $v0
393 | + $temp156 $temp159 $temp156
394 | RET $temp156
395 | FUNC main VOID
396 | VAR cg INT
397 | VAR flag1 INT
398 | VAR re3 INT
399 | VAR re1 INT
400 | VAR para INT
401 | VAR flag2 CHAR
402 | VAR c CHAR
403 | VAR re2 CHAR
404 | ARR cn CHAR 6
405 | PRT $string18 0
406 | LODI $temp163 15
407 | PARA $temp163 1 tempadd
408 | CALL tempadd
409 | LODR $temp162 $v0
410 | CALL caltest
411 | LODR $temp164 $v0
412 | PRT $string19 0
413 | PRT $string20 0
414 | LODV $temp165 ca
415 | PRT $string21 $temp165 2
416 | LODV $temp166 cb
417 | PRT $temp166 1
418 | PRT $string22 0
419 | LODI $temp167 10
420 | = cg $value0 $temp167
421 | LODV $temp168 CA
422 | = va $value0 $temp168
423 | LODI $temp169 0
424 | LODI $temp170 233
425 | = arr $temp169 $temp170
426 | LODI $temp171 1
427 | LODI $temp172 81
428 | = charr $temp171 $temp172
429 | LODI $temp173 3
430 | LODI $temp174 43
431 | = cn $temp173 $temp174
432 | LODI $temp176 1
433 | LODARR charr $temp176 $temp175
434 | = vb $value0 $temp175
435 | LODV $temp177 va
436 | PRT $temp177 1
437 | LODI $temp179 0
438 | LODARR arr $temp179 $temp178
439 | PRT $temp178 1
440 | LODI $temp181 1
441 | LODARR charr $temp181 $temp180
442 | PRT $temp180 1
443 | LODI $temp183 3
444 | LODARR cn $temp183 $temp182
445 | PRT $temp182 1
446 | LODV $temp184 vb
447 | PRT $temp184 1
448 | LODV $temp185 ce
449 | PRT $string23 $temp185 2
450 | LODV $temp186 cc
451 | PRT $temp186 1
452 | CALL returnq
453 | LODR $temp187 $v0
454 | PRT $temp187 1
455 | PRT $string24 0
456 | LODV $temp188 ca
457 | LODV $temp189 cb
458 | + $temp188 $temp189 $temp188
459 | PRT $temp188 1
460 | LODV $temp190 ch
461 | LODV $temp191 ch
462 | + $temp190 $temp191 $temp190
463 | PRT $temp190 1
464 | LODV $temp192 ch
465 | LODV $temp193 CG
466 | + $temp192 $temp193 $temp192
467 | PRT $temp192 1
468 | LODV $temp194 ca
469 | LODV $temp195 cb
470 | + $temp194 $temp195 $temp194
471 | PRT $temp194 1
472 | PRT $string25 0
473 | LODV $temp196 cg
474 | LODI $temp197 0
475 | NEQ $temp196 $temp197 Lab41
476 | PRT $string26 0
477 | LAB Lab41
478 | LODV $temp198 cg
479 | LODI $temp199 10
480 | NEQ $temp198 $temp199 Lab42
481 | PRT $string27 0
482 | LAB Lab42
483 | LODV $temp200 CA
484 | LODV $temp201 ca
485 | NEQ $temp200 $temp201 Lab43
486 | PRT $string28 0
487 | LAB Lab43
488 | LODV $temp202 ca
489 | LODV $temp203 CA
490 | EQU $temp202 $temp203 Lab44
491 | PRT $string29 0
492 | LAB Lab44
493 | PRT $string30 0
494 | SCF flag1
495 | SCF flag2
496 | SCF vc
497 | PRT $string31 0
498 | LODV $temp204 flag1
499 | PRT $string32 $temp204 2
500 | LODV $temp205 flag2
501 | PRT $string33 $temp205 2
502 | LODV $temp206 vc
503 | PRT $string34 $temp206 2
504 | PRT $string35 0
505 | CALL whiletest
506 | LODR $temp207 $v0
507 | PRT $string36 0
508 | LODI $temp208 1
509 | = para $value0 $temp208
510 | LODV $temp210 para
511 | PARA $temp210 1 switchtest
512 | CALL switchtest
513 | LODR $temp209 $v0
514 | = re1 $value0 $temp209
515 | LODV $temp211 re1
516 | PRT $string37 $temp211 2
517 | LODI $temp212 2
518 | = para $value0 $temp212
519 | LODV $temp214 para
520 | PARA $temp214 1 switchtest
521 | CALL switchtest
522 | LODR $temp213 $v0
523 | = re1 $value0 $temp213
524 | LODV $temp215 re1
525 | PRT $string37 $temp215 2
526 | LODI $temp216 3
527 | = para $value0 $temp216
528 | LODV $temp218 para
529 | PARA $temp218 1 switchtest
530 | CALL switchtest
531 | LODR $temp217 $v0
532 | = re1 $value0 $temp217
533 | LODV $temp219 re1
534 | PRT $string37 $temp219 2
535 | LODI $temp220 4
536 | = para $value0 $temp220
537 | LODV $temp222 para
538 | PARA $temp222 1 switchtest
539 | CALL switchtest
540 | LODR $temp221 $v0
541 | = re1 $value0 $temp221
542 | LODV $temp223 re1
543 | PRT $string37 $temp223 2
544 | PRT $string38 0
545 | LODI $temp224 97
546 | = c $value0 $temp224
547 | LODV $temp226 c
548 | PARA $temp226 1 relationcover
549 | CALL relationcover
550 | LODR $temp225 $v0
551 | = re2 $value0 $temp225
552 | LODV $temp227 re2
553 | PRT $temp227 1
554 | PRT $string39 0
555 | LODI $temp228 20
556 | = para $value0 $temp228
557 | LODV $temp230 para
558 | PARA $temp230 1 f
559 | CALL f
560 | LODR $temp229 $v0
561 | = re3 $value0 $temp229
562 | LODV $temp231 re3
563 | PRT $temp231 1
564 |
--------------------------------------------------------------------------------
/C0-Compiler/C0-Compiler/C0-Compiler.cpp:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/luxiaodou/CompilerAssignments/28d2d0c63789aed3c4c0823e057669b5ca5f4800/C0-Compiler/C0-Compiler/C0-Compiler.cpp
--------------------------------------------------------------------------------
/C0-Compiler/C0-Compiler/C0-Compiler.vcxproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | Debug
6 | Win32
7 |
8 |
9 | Release
10 | Win32
11 |
12 |
13 |
14 | {B5782598-15E5-4A29-A78C-7969A38BE9CD}
15 | Win32Proj
16 | C0Compiler
17 |
18 |
19 |
20 | Application
21 | true
22 | Unicode
23 |
24 |
25 | Application
26 | false
27 | true
28 | Unicode
29 |
30 |
31 |
32 |
33 |
34 |
35 |
36 |
37 |
38 |
39 |
40 |
41 | true
42 | false
43 |
44 |
45 | false
46 |
47 |
48 |
49 | Use
50 | Level3
51 | Disabled
52 | WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions)
53 |
54 |
55 | Console
56 | true
57 |
58 |
59 |
60 |
61 | Level3
62 | Use
63 | MaxSpeed
64 | true
65 | true
66 | WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions)
67 |
68 |
69 | Console
70 | true
71 | true
72 | true
73 |
74 |
75 |
76 |
77 |
78 |
79 |
80 |
81 |
82 |
83 |
84 |
85 |
86 |
87 |
88 |
89 |
90 |
91 |
92 |
93 |
94 |
95 |
96 |
97 |
98 | Create
99 | Create
100 |
101 |
102 |
103 |
104 |
105 |
106 |
107 |
108 |
--------------------------------------------------------------------------------
/C0-Compiler/C0-Compiler/C0-Compiler.vcxproj.filters:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | {4FC737F1-C7A5-4376-A066-2A32D752A2FF}
6 | cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx
7 |
8 |
9 | {93995380-89BD-4b04-88EB-625FBE52EBFB}
10 | h;hpp;hxx;hm;inl;inc;xsd
11 |
12 |
13 | {67DA6AB6-F800-4c08-8B7A-83BB121AAD01}
14 | rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms
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 | 源文件
82 |
83 |
84 |
--------------------------------------------------------------------------------
/C0-Compiler/C0-Compiler/C0-Compiler.vcxproj.user:
--------------------------------------------------------------------------------
1 |
2 |
3 |
--------------------------------------------------------------------------------
/C0-Compiler/C0-Compiler/Debug/C0-Compiler.Build.CppClean.log:
--------------------------------------------------------------------------------
1 | E:\LESSONS\GIT\COMPILERASSIGNMENTS\C0-COMPILER\C0-COMPILER\DEBUG\C0-COMPILER.EXE.INTERMEDIATE.MANIFEST
2 | E:\LESSONS\GIT\COMPILERASSIGNMENTS\C0-COMPILER\C0-COMPILER\DEBUG\C0-COMPILER.OBJ
3 | E:\LESSONS\GIT\COMPILERASSIGNMENTS\C0-COMPILER\C0-COMPILER\DEBUG\C0-COMPILER.PCH
4 | E:\Lessons\Git\CompilerAssignments\C0-Compiler\C0-Compiler\Debug\cl.command.1.tlog
5 | E:\Lessons\Git\CompilerAssignments\C0-Compiler\C0-Compiler\Debug\CL.read.1.tlog
6 | E:\Lessons\Git\CompilerAssignments\C0-Compiler\C0-Compiler\Debug\CL.write.1.tlog
7 | E:\LESSONS\GIT\COMPILERASSIGNMENTS\C0-COMPILER\C0-COMPILER\DEBUG\GENERATOR.OBJ
8 | E:\LESSONS\GIT\COMPILERASSIGNMENTS\C0-COMPILER\C0-COMPILER\DEBUG\LEXER.OBJ
9 | E:\Lessons\Git\CompilerAssignments\C0-Compiler\C0-Compiler\Debug\link.command.1.tlog
10 | E:\Lessons\Git\CompilerAssignments\C0-Compiler\C0-Compiler\Debug\link.read.1.tlog
11 | E:\Lessons\Git\CompilerAssignments\C0-Compiler\C0-Compiler\Debug\link.write.1.tlog
12 | E:\Lessons\Git\CompilerAssignments\C0-Compiler\C0-Compiler\Debug\mt.command.1.tlog
13 | E:\Lessons\Git\CompilerAssignments\C0-Compiler\C0-Compiler\Debug\mt.read.1.tlog
14 | E:\Lessons\Git\CompilerAssignments\C0-Compiler\C0-Compiler\Debug\mt.write.1.tlog
15 | E:\LESSONS\GIT\COMPILERASSIGNMENTS\C0-COMPILER\C0-COMPILER\DEBUG\OPTIMIZER.OBJ
16 | E:\LESSONS\GIT\COMPILERASSIGNMENTS\C0-COMPILER\C0-COMPILER\DEBUG\PARSER.OBJ
17 | E:\LESSONS\GIT\COMPILERASSIGNMENTS\C0-COMPILER\C0-COMPILER\DEBUG\QUADRUPLE.OBJ
18 | E:\LESSONS\GIT\COMPILERASSIGNMENTS\C0-COMPILER\C0-COMPILER\DEBUG\STDAFX.OBJ
19 | E:\LESSONS\GIT\COMPILERASSIGNMENTS\C0-COMPILER\C0-COMPILER\DEBUG\TABLE.OBJ
20 | E:\LESSONS\GIT\COMPILERASSIGNMENTS\C0-COMPILER\C0-COMPILER\DEBUG\TABLEITEM.OBJ
21 | E:\Lessons\Git\CompilerAssignments\C0-Compiler\C0-Compiler\Debug\vc100.idb
22 | E:\LESSONS\GIT\COMPILERASSIGNMENTS\C0-COMPILER\C0-COMPILER\DEBUG\VC100.PDB
23 | E:\LESSONS\GIT\COMPILERASSIGNMENTS\C0-COMPILER\DEBUG\C0-COMPILER.EXE
24 | E:\LESSONS\GIT\COMPILERASSIGNMENTS\C0-COMPILER\DEBUG\C0-COMPILER.EXE.MANIFEST
25 | E:\LESSONS\GIT\COMPILERASSIGNMENTS\C0-COMPILER\DEBUG\C0-COMPILER.ILK
26 | E:\LESSONS\GIT\COMPILERASSIGNMENTS\C0-COMPILER\DEBUG\C0-COMPILER.PDB
27 |
--------------------------------------------------------------------------------
/C0-Compiler/C0-Compiler/Debug/C0-Compiler.log:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/C0-Compiler/C0-Compiler/Generator.cpp:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/luxiaodou/CompilerAssignments/28d2d0c63789aed3c4c0823e057669b5ca5f4800/C0-Compiler/C0-Compiler/Generator.cpp
--------------------------------------------------------------------------------
/C0-Compiler/C0-Compiler/Generator.h:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/luxiaodou/CompilerAssignments/28d2d0c63789aed3c4c0823e057669b5ca5f4800/C0-Compiler/C0-Compiler/Generator.h
--------------------------------------------------------------------------------
/C0-Compiler/C0-Compiler/Lexer.h:
--------------------------------------------------------------------------------
1 | #pragma once
2 | #include
3 | #include
4 | #include
5 | #include
6 | #include
7 | #include "error.h"
8 | #include "defination.h"
9 |
10 | using namespace std;
11 | class Lexer {
12 | public:
13 | static char ch;
14 | static string token, inputline, path;
15 | static int sym, line, count, ll, lc;
16 | static long long value;
17 | static ifstream infile;
18 | static ofstream outfile;
19 | static void output();
20 | static int getsym();
21 | static void backup();
22 | static void retrieve();
23 | static void init();
24 | static void getpath();
25 | static void close();
26 | private:
27 | static streampos bookmark;
28 | static int bline, bcount, bll, blc, bsym;
29 | static string binputline;
30 | static bool inquote;
31 | static void clearToken();
32 | static void getnextline();
33 | static void getch();
34 | static void catToken();
35 | static void skip();
36 | static bool isLetter();
37 | static bool isDigit();
38 | static void retract();
39 | static int isreserve();
40 | static bool isStringCon();
41 | };
--------------------------------------------------------------------------------
/C0-Compiler/C0-Compiler/Optimizer.cpp:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/luxiaodou/CompilerAssignments/28d2d0c63789aed3c4c0823e057669b5ca5f4800/C0-Compiler/C0-Compiler/Optimizer.cpp
--------------------------------------------------------------------------------
/C0-Compiler/C0-Compiler/Parser.cpp:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/luxiaodou/CompilerAssignments/28d2d0c63789aed3c4c0823e057669b5ca5f4800/C0-Compiler/C0-Compiler/Parser.cpp
--------------------------------------------------------------------------------
/C0-Compiler/C0-Compiler/Parser.h:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/luxiaodou/CompilerAssignments/28d2d0c63789aed3c4c0823e057669b5ca5f4800/C0-Compiler/C0-Compiler/Parser.h
--------------------------------------------------------------------------------
/C0-Compiler/C0-Compiler/Quadruple.cpp:
--------------------------------------------------------------------------------
1 | #include "stdafx.h"
2 | #include "global.h"
3 | #include "Quadruple.h"
4 |
5 |
6 | Quadruple::Quadruple()
7 | {
8 | }
9 |
10 | Quadruple::Quadruple(string a, string b, string c, string d)
11 | {
12 | op = a;
13 | para1 = b;
14 | para2 = c;
15 | para3 = d;
16 | }
17 |
18 | Quadruple::~Quadruple()
19 | {
20 | }
21 |
22 | void Quadruple::fill(string op,string para1, string para2, string para3)
23 | {
24 | this->op = op;
25 | this->para1 = para1;
26 | this->para2 = para2;
27 | this->para3 = para3;
28 | }
29 |
30 |
--------------------------------------------------------------------------------
/C0-Compiler/C0-Compiler/Quadruple.h:
--------------------------------------------------------------------------------
1 | #pragma once
2 | #include
3 | using namespace std;
4 | class Quadruple {
5 | public:
6 | string op;
7 | string para1;
8 | string para2;
9 | string para3;
10 | Quadruple();
11 | Quadruple(string a, string b, string c, string d);
12 | ~Quadruple();
13 | void fill(string op,string para1,string para2, string para3);
14 | private:
15 | };
--------------------------------------------------------------------------------
/C0-Compiler/C0-Compiler/ReadMe.txt:
--------------------------------------------------------------------------------
1 | ========================================================================
2 | 控制台应用程序:C0-Compiler 项目概述
3 | ========================================================================
4 |
5 | 应用程序向导已为您创建了此 C0-Compiler 应用程序。
6 |
7 | 本文件概要介绍组成 C0-Compiler 应用程序的每个文件的内容。
8 |
9 |
10 | C0-Compiler.vcxproj
11 | 这是使用应用程序向导生成的 VC++ 项目的主项目文件,
12 | 其中包含生成该文件的 Visual C++
13 | 的版本信息,以及有关使用应用程序向导选择的平台、配置和项目功能的信息。
14 |
15 | C0-Compiler.vcxproj.filters
16 | 这是使用“应用程序向导”生成的 VC++ 项目筛选器文件。
17 | 它包含有关项目文件与筛选器之间的关联信息。 在 IDE
18 | 中,通过这种关联,在特定节点下以分组形式显示具有相似扩展名的文件。
19 | 例如,“.cpp”文件与“源文件”筛选器关联。
20 |
21 | C0-Compiler.cpp
22 | 这是主应用程序源文件。
23 |
24 | /////////////////////////////////////////////////////////////////////////////
25 | 其他标准文件:
26 |
27 | StdAfx.h,StdAfx.cpp
28 | 这些文件用于生成名为 C0-Compiler.pch 的预编译头 (PCH) 文件和
29 | 名为 StdAfx.obj 的预编译类型文件。
30 |
31 | /////////////////////////////////////////////////////////////////////////////
32 | 其他注释:
33 |
34 | 应用程序向导使用“TODO:”注释来指示应添加或自定义的源代码部分。
35 |
36 | /////////////////////////////////////////////////////////////////////////////
37 |
--------------------------------------------------------------------------------
/C0-Compiler/C0-Compiler/Release/C0-Compiler.exe.intermediate.manifest:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
--------------------------------------------------------------------------------
/C0-Compiler/C0-Compiler/Release/C0-Compiler.lastbuildstate:
--------------------------------------------------------------------------------
1 | #v4.0:v100
2 | Release|Win32|E:\Lessons\Git\CompilerAssignments\C0-Compiler\|
3 |
--------------------------------------------------------------------------------
/C0-Compiler/C0-Compiler/Release/C0-Compiler.log:
--------------------------------------------------------------------------------
1 | C0-Compiler.cpp
2 | 正在生成代码
3 | 已完成代码的生成
4 | C0-Compiler.vcxproj -> E:\Lessons\Git\CompilerAssignments\C0-Compiler\Release\C0-Compiler.exe
5 |
--------------------------------------------------------------------------------
/C0-Compiler/C0-Compiler/Release/C0-Compiler.obj:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/luxiaodou/CompilerAssignments/28d2d0c63789aed3c4c0823e057669b5ca5f4800/C0-Compiler/C0-Compiler/Release/C0-Compiler.obj
--------------------------------------------------------------------------------
/C0-Compiler/C0-Compiler/Release/C0-Compiler.pch:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/luxiaodou/CompilerAssignments/28d2d0c63789aed3c4c0823e057669b5ca5f4800/C0-Compiler/C0-Compiler/Release/C0-Compiler.pch
--------------------------------------------------------------------------------
/C0-Compiler/C0-Compiler/Release/CL.read.1.tlog:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/luxiaodou/CompilerAssignments/28d2d0c63789aed3c4c0823e057669b5ca5f4800/C0-Compiler/C0-Compiler/Release/CL.read.1.tlog
--------------------------------------------------------------------------------
/C0-Compiler/C0-Compiler/Release/CL.write.1.tlog:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/luxiaodou/CompilerAssignments/28d2d0c63789aed3c4c0823e057669b5ca5f4800/C0-Compiler/C0-Compiler/Release/CL.write.1.tlog
--------------------------------------------------------------------------------
/C0-Compiler/C0-Compiler/Release/Generator.obj:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/luxiaodou/CompilerAssignments/28d2d0c63789aed3c4c0823e057669b5ca5f4800/C0-Compiler/C0-Compiler/Release/Generator.obj
--------------------------------------------------------------------------------
/C0-Compiler/C0-Compiler/Release/Lexer.obj:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/luxiaodou/CompilerAssignments/28d2d0c63789aed3c4c0823e057669b5ca5f4800/C0-Compiler/C0-Compiler/Release/Lexer.obj
--------------------------------------------------------------------------------
/C0-Compiler/C0-Compiler/Release/Optimizer.obj:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/luxiaodou/CompilerAssignments/28d2d0c63789aed3c4c0823e057669b5ca5f4800/C0-Compiler/C0-Compiler/Release/Optimizer.obj
--------------------------------------------------------------------------------
/C0-Compiler/C0-Compiler/Release/Parser.obj:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/luxiaodou/CompilerAssignments/28d2d0c63789aed3c4c0823e057669b5ca5f4800/C0-Compiler/C0-Compiler/Release/Parser.obj
--------------------------------------------------------------------------------
/C0-Compiler/C0-Compiler/Release/Quadruple.obj:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/luxiaodou/CompilerAssignments/28d2d0c63789aed3c4c0823e057669b5ca5f4800/C0-Compiler/C0-Compiler/Release/Quadruple.obj
--------------------------------------------------------------------------------
/C0-Compiler/C0-Compiler/Release/Table.obj:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/luxiaodou/CompilerAssignments/28d2d0c63789aed3c4c0823e057669b5ca5f4800/C0-Compiler/C0-Compiler/Release/Table.obj
--------------------------------------------------------------------------------
/C0-Compiler/C0-Compiler/Release/TableItem.obj:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/luxiaodou/CompilerAssignments/28d2d0c63789aed3c4c0823e057669b5ca5f4800/C0-Compiler/C0-Compiler/Release/TableItem.obj
--------------------------------------------------------------------------------
/C0-Compiler/C0-Compiler/Release/cl.command.1.tlog:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/luxiaodou/CompilerAssignments/28d2d0c63789aed3c4c0823e057669b5ca5f4800/C0-Compiler/C0-Compiler/Release/cl.command.1.tlog
--------------------------------------------------------------------------------
/C0-Compiler/C0-Compiler/Release/link.command.1.tlog:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/luxiaodou/CompilerAssignments/28d2d0c63789aed3c4c0823e057669b5ca5f4800/C0-Compiler/C0-Compiler/Release/link.command.1.tlog
--------------------------------------------------------------------------------
/C0-Compiler/C0-Compiler/Release/link.read.1.tlog:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/luxiaodou/CompilerAssignments/28d2d0c63789aed3c4c0823e057669b5ca5f4800/C0-Compiler/C0-Compiler/Release/link.read.1.tlog
--------------------------------------------------------------------------------
/C0-Compiler/C0-Compiler/Release/link.write.1.tlog:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/luxiaodou/CompilerAssignments/28d2d0c63789aed3c4c0823e057669b5ca5f4800/C0-Compiler/C0-Compiler/Release/link.write.1.tlog
--------------------------------------------------------------------------------
/C0-Compiler/C0-Compiler/Release/mt.command.1.tlog:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/luxiaodou/CompilerAssignments/28d2d0c63789aed3c4c0823e057669b5ca5f4800/C0-Compiler/C0-Compiler/Release/mt.command.1.tlog
--------------------------------------------------------------------------------
/C0-Compiler/C0-Compiler/Release/mt.read.1.tlog:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/luxiaodou/CompilerAssignments/28d2d0c63789aed3c4c0823e057669b5ca5f4800/C0-Compiler/C0-Compiler/Release/mt.read.1.tlog
--------------------------------------------------------------------------------
/C0-Compiler/C0-Compiler/Release/mt.write.1.tlog:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/luxiaodou/CompilerAssignments/28d2d0c63789aed3c4c0823e057669b5ca5f4800/C0-Compiler/C0-Compiler/Release/mt.write.1.tlog
--------------------------------------------------------------------------------
/C0-Compiler/C0-Compiler/Release/stdafx.obj:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/luxiaodou/CompilerAssignments/28d2d0c63789aed3c4c0823e057669b5ca5f4800/C0-Compiler/C0-Compiler/Release/stdafx.obj
--------------------------------------------------------------------------------
/C0-Compiler/C0-Compiler/Release/vc100.pdb:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/luxiaodou/CompilerAssignments/28d2d0c63789aed3c4c0823e057669b5ca5f4800/C0-Compiler/C0-Compiler/Release/vc100.pdb
--------------------------------------------------------------------------------
/C0-Compiler/C0-Compiler/Table.cpp:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/luxiaodou/CompilerAssignments/28d2d0c63789aed3c4c0823e057669b5ca5f4800/C0-Compiler/C0-Compiler/Table.cpp
--------------------------------------------------------------------------------
/C0-Compiler/C0-Compiler/Table.h:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/luxiaodou/CompilerAssignments/28d2d0c63789aed3c4c0823e057669b5ca5f4800/C0-Compiler/C0-Compiler/Table.h
--------------------------------------------------------------------------------
/C0-Compiler/C0-Compiler/TableItem.cpp:
--------------------------------------------------------------------------------
1 | #include "StdAfx.h"
2 | #include "TableItem.h"
3 |
4 |
5 | TableItem::TableItem()
6 | {
7 | this->name = "";
8 | this->addr = 0;
9 | this->kind = 0;
10 | this->type = 0;
11 | this->value = 0;
12 | this->number = 0;
13 | }
14 |
15 | TableItem::TableItem(string na, int add, int kin, int typ, int val, int num,string father)
16 | {
17 | this->name = na;
18 | this->addr = add;
19 | this->kind = kin;
20 | this->type = typ;
21 | this->value = val;
22 | this->number = num;
23 | this->father = father;
24 | }
25 |
26 |
27 | TableItem::~TableItem()
28 | {
29 | }
30 |
--------------------------------------------------------------------------------
/C0-Compiler/C0-Compiler/TableItem.h:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/luxiaodou/CompilerAssignments/28d2d0c63789aed3c4c0823e057669b5ca5f4800/C0-Compiler/C0-Compiler/TableItem.h
--------------------------------------------------------------------------------
/C0-Compiler/C0-Compiler/defination.h:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/luxiaodou/CompilerAssignments/28d2d0c63789aed3c4c0823e057669b5ca5f4800/C0-Compiler/C0-Compiler/defination.h
--------------------------------------------------------------------------------
/C0-Compiler/C0-Compiler/error.cpp:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/luxiaodou/CompilerAssignments/28d2d0c63789aed3c4c0823e057669b5ca5f4800/C0-Compiler/C0-Compiler/error.cpp
--------------------------------------------------------------------------------
/C0-Compiler/C0-Compiler/error.h:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/luxiaodou/CompilerAssignments/28d2d0c63789aed3c4c0823e057669b5ca5f4800/C0-Compiler/C0-Compiler/error.h
--------------------------------------------------------------------------------
/C0-Compiler/C0-Compiler/global.h:
--------------------------------------------------------------------------------
1 | #pragma once
2 | /////////////////////////global include/////////////////////////////
3 | #include
4 | #include
5 | #include
6 | #include
7 | #include
8 | #include