Skip to content

Commit bc7480e

Browse files
committed
Remove denugging prints
1 parent 84cb0c6 commit bc7480e

File tree

2 files changed

+3
-22
lines changed

2 files changed

+3
-22
lines changed

java_parser.y

Lines changed: 3 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -85,10 +85,7 @@ statement_list:
8585
statement {*($$.nextList) = *($1.nextList);}
8686
|statement_list marker_m statement
8787
{
88-
cout<<"Backpacth statement List"<<endl;
89-
cout<< $2.nextInstructionIndex << endl;
9088
backpatch(*($1.nextList) ,$2.nextInstructionIndex);
91-
cout<<"finish backpatch"<<endl;
9289
*($$.nextList) = *($3.nextList);
9390
}
9491
;
@@ -111,9 +108,8 @@ marker_m:
111108

112109
marker_n:
113110
%empty{
114-
cout<<"In marker n ==================== "<< nextInstructionIndex<<" ======"<<endl;
115111
// Save the index of the next instruction index in the marker
116-
$$.nextList = new unordered_set<int>();
112+
$$.nextList = new unordered_set<int>();
117113
*($$.nextList) = makeList(nextInstructionIndex);
118114
appendToCode("goto _");
119115
}
@@ -138,16 +134,9 @@ if:
138134
'{' statement_list '}'
139135
marker_n
140136
ELSE '{' marker_m statement_list '}' {
141-
cout<<"backpatching in if else"<<endl;
142137
backpatch(*($3.trueList), $5.nextInstructionIndex);
143-
cout<<"backpatching in if else"<<endl;
144138
backpatch(*($3.falseList), $12.nextInstructionIndex);
145-
cout<<"Finish backpatch if else"<<endl;
146139
std::unordered_set<int> temp = mergeLists( *($7.nextList), *($9.nextList));
147-
148-
cout<<"printing nextlist 9 ====================="<<endl;
149-
for(auto &&item:*($9.nextList)) cout<<outputCode[item]<<endl;
150-
151140
$$.nextList = new unordered_set<int>();
152141
*($$.nextList) = mergeLists(temp, *($13.nextList));
153142
}
@@ -156,20 +145,15 @@ if:
156145
while:
157146
WHILE marker_m '(' boolean_expression ')'
158147
'{' marker_m statement_list '}' {
159-
cout<<"backpatching in while"<<endl;
160148
backpatch(*($8.nextList), $2.nextInstructionIndex);
161149
backpatch(*($4.trueList), $7.nextInstructionIndex);
162-
cout<<"finish backpatch"<<endl;
163-
cout<<"next inst index ==== "<<nextInstructionIndex<<" "<<outputCode.size()<<endl;
164-
for(auto &&item:outputCode) cout<<item<<endl;
165150
$$.nextList = new unordered_set<int>();
166151
*($$.nextList) = *($4.falseList);
167152
appendToCode("goto Label_" + to_string($2.nextInstructionIndex));
168153
}
169154
;
170155

171156
assignment: IDENTIFIER '=' expression ';'{
172-
cout<<"asg: "<<$1<<" "<<" "<<$3.varType<<endl;
173157
if(checkIfVariableExists($1)) {
174158
//Check if the two sides have the same type
175159
if(varToVarIndexAndType[$1].second == $3.varType) {
@@ -232,24 +216,22 @@ boolean_expression:
232216
$$.trueList->insert(static_cast<int>(outputCode.size()));
233217
$$.falseList = new unordered_set<int>();
234218
// write code goto line #
235-
appendToCode("goto _");
219+
appendToCode("goto _");
236220
}
237221
|FALSE {
238222
$$.trueList = new unordered_set<int> ();
239223
$$.falseList= new unordered_set<int>();
240224
$$.falseList->insert(static_cast<int>(outputCode.size()));
241225
// write code goto line #
242-
appendToCode("goto _");
226+
appendToCode("goto _");
243227
}
244228
|boolean_expression BOOL_OP marker_m boolean_expression {
245229
if(!strcmp($2, "&&")) {
246-
cout<<"backpatching bool"<<endl;
247230
backpatch(*($1.trueList), $3.nextInstructionIndex);
248231
*($$.trueList) = *($4.trueList);
249232
*($$.falseList) = mergeLists(*($1.falseList), *($4.falseList));
250233
}
251234
else if (!strcmp($2,"||")) {
252-
cout<<"backpatching in bool"<<endl;
253235
backpatch(*($1.falseList), $3.nextInstructionIndex);
254236
*($$.trueList) = mergeLists(*($1.trueList), *($4.trueList));
255237
*($$.falseList) = *($4.falseList);

semantic_actions_utils.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,6 @@ namespace semantic_actions_util {
6060

6161
void backpatch(unordered_set<int> list, int instruction_index) {
6262
for (auto index : list) {
63-
cout<<"backpatch "<<outputCode[index]<<endl;
6463
outputCode[index] = outputCode[index].substr(0, outputCode[index].size()-1);
6564
outputCode[index] += "Label_" + to_string(instruction_index);
6665
}

0 commit comments

Comments
 (0)