diff options
author | pacien | 2018-06-05 22:16:41 +0200 |
---|---|---|
committer | pacien | 2018-06-05 22:16:41 +0200 |
commit | 864653f00dff0a8a1f37d8e9a732c1da8309a930 (patch) | |
tree | 4d74467805dde7e6a30f43160d1f808313bc27d4 | |
parent | d07aa27c361c424e1da383ae49e98e5dfb33425e (diff) | |
parent | 591dc73d84573f949f30d98107acb417522bcdd6 (diff) | |
download | tpc-compiler-864653f00dff0a8a1f37d8e9a732c1da8309a930.tar.gz |
Merge branch 'master' of https://github.com/pacien/upem-compil-tpc
-rw-r--r-- | src/generator.c | 2 | ||||
-rw-r--r-- | src/tpc.y | 3 |
2 files changed, 3 insertions, 2 deletions
diff --git a/src/generator.c b/src/generator.c index 0040c02..3ecfe0d 100644 --- a/src/generator.c +++ b/src/generator.c | |||
@@ -225,7 +225,7 @@ void gen_if_end(int idx) { | |||
225 | 225 | ||
226 | void gen_ifelse_end(int idx) { | 226 | void gen_ifelse_end(int idx) { |
227 | fprintf(output, ".end_ifelse%d:\n", idx); | 227 | fprintf(output, ".end_ifelse%d:\n", idx); |
228 | fprintf(output, "ENDIF\n\n"); | 228 | fprintf(output, ";ENDIF\n\n"); |
229 | } | 229 | } |
230 | 230 | ||
231 | // ----- OPERATORS ----- | 231 | // ----- OPERATORS ----- |
@@ -23,6 +23,7 @@ static Type return_type = VOID_T; | |||
23 | static int bss_done = 0; | 23 | static int bss_done = 0; |
24 | static int num_label = 0; | 24 | static int num_label = 0; |
25 | static int num_if = 0; | 25 | static int num_if = 0; |
26 | static int num_while = 0; | ||
26 | static int nb_param[255]; | 27 | static int nb_param[255]; |
27 | static int num_scope = -1; | 28 | static int num_scope = -1; |
28 | static char fname[64]; | 29 | static 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 | ; |
131 | IfHandling: { gen_if_start($<num>$ = num_if++); }; | 132 | IfHandling: { gen_if_start($<num>$ = num_if++); }; |