diff options
Diffstat (limited to 'src/generator.c')
-rw-r--r-- | src/generator.c | 14 |
1 files changed, 13 insertions, 1 deletions
diff --git a/src/generator.c b/src/generator.c index e4b79e3..9948966 100644 --- a/src/generator.c +++ b/src/generator.c | |||
@@ -74,7 +74,7 @@ void gen_prologue_continue(bool *bss_done) { | |||
74 | fprintf(output, "pop rsi\n"); | 74 | fprintf(output, "pop rsi\n"); |
75 | fprintf(output, "pop rbp\n"); | 75 | fprintf(output, "pop rbp\n"); |
76 | fprintf(output, "ret\n"); | 76 | fprintf(output, "ret\n"); |
77 | *bss_done = 1; | 77 | *bss_done = true; |
78 | } | 78 | } |
79 | 79 | ||
80 | void gen_epilogue() { | 80 | void gen_epilogue() { |
@@ -523,3 +523,15 @@ int gen_char(int value, Scope scope) { | |||
523 | fprintf(output, "push %d\n", value); | 523 | fprintf(output, "push %d\n", value); |
524 | return CHAR; | 524 | return CHAR; |
525 | } | 525 | } |
526 | |||
527 | void gen_while_start(int id) { | ||
528 | fprintf(output,".upwhile%d:\n", id); | ||
529 | } | ||
530 | |||
531 | void gen_while_cond(int id) { | ||
532 | fprintf(output,"pop rax\ncmp rax,0\njz .downwhile%d\n", id); | ||
533 | } | ||
534 | |||
535 | void gen_while_end(int id) { | ||
536 | fprintf(output,"jmp .upwhile%d\n.downwhile%d:\n", id, id); | ||
537 | } | ||