aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAdam NAILI2018-06-05 21:57:13 +0200
committerAdam NAILI2018-06-05 21:57:13 +0200
commit591dc73d84573f949f30d98107acb417522bcdd6 (patch)
treefaa0f3b7e42eef27eca6b636051e14009a8dea46
parent56e31e3b8a1a569f42140547ffda5a91ef451b47 (diff)
downloadtpc-compiler-591dc73d84573f949f30d98107acb417522bcdd6.tar.gz
Fixing parameters
-rw-r--r--src/generator.c2
-rw-r--r--src/tpc.y3
2 files changed, 3 insertions, 2 deletions
diff --git a/src/generator.c b/src/generator.c
index b8a0b8f..0a40570 100644
--- a/src/generator.c
+++ b/src/generator.c
@@ -208,7 +208,7 @@ void gen_if_end(int idx) {
208 208
209void gen_ifelse_end(int idx) { 209void gen_ifelse_end(int idx) {
210 fprintf(output, ".end_ifelse%d:\n", idx); 210 fprintf(output, ".end_ifelse%d:\n", idx);
211 fprintf(output, "ENDIF\n\n"); 211 fprintf(output, ";ENDIF\n\n");
212} 212}
213 213
214// ----- OPERATORS ----- 214// ----- OPERATORS -----
diff --git a/src/tpc.y b/src/tpc.y
index 9878ce7..4acc009 100644
--- a/src/tpc.y
+++ b/src/tpc.y
@@ -23,6 +23,7 @@ static Type return_type = VOID_T;
23static int bss_done = 0; 23static int bss_done = 0;
24static int num_label = 0; 24static int num_label = 0;
25static int num_if = 0; 25static int num_if = 0;
26static int num_while = 0;
26static int nb_param[255]; 27static int nb_param[255];
27static int num_scope = -1; 28static int num_scope = -1;
28static char fname[64]; 29static char fname[64];
@@ -125,7 +126,7 @@ Instr:
125| PRINT '(' Exp ')' ';' { gen_print($<type>3);} 126| PRINT '(' Exp ')' ';' { gen_print($<type>3);}
126| IF '(' Exp IfHandling')' Instr { gen_if_label($<num>4); } 127| IF '(' Exp IfHandling')' Instr { gen_if_label($<num>4); }
127| IF '(' Exp IfHandling')' Instr ELSE IfEndHandling Instr IfElseEndHandling 128| IF '(' Exp IfHandling')' Instr ELSE IfEndHandling Instr IfElseEndHandling
128| WHILE '(' Exp ')' Instr 129| WHILE '(' Exp ')' Instr
129| '{' SuiteInstr '}' 130| '{' SuiteInstr '}'
130; 131;
131IfHandling: { gen_if_start($<num>$ = num_if++); }; 132IfHandling: { gen_if_start($<num>$ = num_if++); };