diff options
author | pacien | 2018-06-05 23:05:46 +0200 |
---|---|---|
committer | pacien | 2018-06-05 23:05:46 +0200 |
commit | 12c6e05e4c341e3db89e4551299b3f10e7623542 (patch) | |
tree | 73051e24d0c4e0ca8ee47b56cb83453177bedbb8 /src/tpc.y | |
parent | 9a661bc8e79398cb842a64fcd3169c3895d48a54 (diff) | |
parent | a037a641ca537f012865b2655917207af683ea1f (diff) | |
download | tpc-compiler-12c6e05e4c341e3db89e4551299b3f10e7623542.tar.gz |
Merge branch 'master' of https://github.com/pacien/upem-compil-tpc
Diffstat (limited to 'src/tpc.y')
-rw-r--r-- | src/tpc.y | 2 |
1 files changed, 1 insertions, 1 deletions
@@ -126,7 +126,7 @@ Instr: | |||
126 | | PRINT '(' Exp ')' ';' { gen_print($<type>3);} | 126 | | PRINT '(' Exp ')' ';' { gen_print($<type>3);} |
127 | | IF '(' Exp IfHandling')' Instr { gen_if_label($<num>4); } | 127 | | IF '(' Exp IfHandling')' Instr { gen_if_label($<num>4); } |
128 | | IF '(' Exp IfHandling')' Instr ELSE IfEndHandling Instr IfElseEndHandling | 128 | | IF '(' Exp IfHandling')' Instr ELSE IfEndHandling Instr IfElseEndHandling |
129 | | WHILE '(' Exp ')' Instr | 129 | | WHILE {fprintf(output,".upwhile%d:\n",num_while);}'(' Exp {fprintf(output,"pop rax\ncmp rax,0\njz .downwhile%d\n",num_while);}')' Instr {fprintf(output,"jmp .upwhile%d\n.downwhile%d:\n",num_while,num_while);num_while++;} |
130 | | '{' SuiteInstr '}' | 130 | | '{' SuiteInstr '}' |
131 | ; | 131 | ; |
132 | IfHandling: { gen_if_start($<num>$ = num_if++); }; | 132 | IfHandling: { gen_if_start($<num>$ = num_if++); }; |