質問編集履歴

2

誤字の修正

2021/07/21 08:30

投稿

Rauto
Rauto

スコア2

test CHANGED
File without changes
test CHANGED
@@ -62,10 +62,6 @@
62
62
 
63
63
  %%
64
64
 
65
- dowhile { return DOWHILE; }
66
-
67
- while { return WHILE; }
68
-
69
65
  if { return IF; }
70
66
 
71
67
  read { return READ; }
@@ -118,10 +114,6 @@
118
114
 
119
115
  |PRINT expr ';' { $$ = node(T_PRINT, $2, 0); }
120
116
 
121
- |WHILE '(' log ')' stat { $$ = node(T_WHILE, $3, $5); }
122
-
123
- |DOWHILE '(' log ')' stat { $$ = node(T_DOWHILE, $3, $5); }
124
-
125
117
  |IF '(' log ')' stat { $$ = node(T_IF, $3, $5); }
126
118
 
127
119
  | '{' stlist '}' { $$ = $2; }
@@ -230,16 +222,12 @@
230
222
 
231
223
  #define T_VAR 11
232
224
 
233
- #define T_WHILE 12
234
-
235
225
  #define T_IF 13
236
226
 
237
227
  #define T_LT 14
238
228
 
239
229
  #define T_GT 15
240
230
 
241
- #define T_DOWHILE 16
242
-
243
231
  #define T_AND 17 /*ANDを追加*/
244
232
 
245
233
 
@@ -566,37 +554,7 @@
566
554
 
567
555
  break;
568
556
 
569
- case T_WHILE: l = labelno; labelno+=2;
557
+
570
-
571
- printf(".L%d:\n", l);
572
-
573
- emittree(ntab[i].left);
574
-
575
- printf(".L%d\n", l+1);
576
-
577
- emittree(ntab[i].right);
578
-
579
- printf(" jmp .L%d\n", l);
580
-
581
- printf(".L%d:\n", l+1);
582
-
583
- break;
584
-
585
- case T_DOWHILE:l = labelno; labelno+=2;
586
-
587
- printf(".L%d:\n", l);
588
-
589
- emittree(ntab[i].right);
590
-
591
- emittree(ntab[i].left);
592
-
593
- printf(".L%d\n", l+1);
594
-
595
- printf(" jmp .L%d\n", l);
596
-
597
- printf(".L%d:\n", l+1);
598
-
599
- break;
600
558
 
601
559
 
602
560
 

1

タグの追加

2021/07/21 08:30

投稿

Rauto
Rauto

スコア2

test CHANGED
@@ -1 +1 @@
1
- 自作コンパイラの論理積の実現
1
+ 自作コンパイラの論理積の実現で構文エラーが出る
test CHANGED
File without changes