From 591dc73d84573f949f30d98107acb417522bcdd6 Mon Sep 17 00:00:00 2001 From: Adam NAILI Date: Tue, 5 Jun 2018 21:57:13 +0200 Subject: Fixing parameters --- src/generator.c | 2 +- src/tpc.y | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) (limited to 'src') 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) { void gen_ifelse_end(int idx) { fprintf(output, ".end_ifelse%d:\n", idx); - fprintf(output, "ENDIF\n\n"); + fprintf(output, ";ENDIF\n\n"); } // ----- 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; static int bss_done = 0; static int num_label = 0; static int num_if = 0; +static int num_while = 0; static int nb_param[255]; static int num_scope = -1; static char fname[64]; @@ -125,7 +126,7 @@ Instr: | PRINT '(' Exp ')' ';' { gen_print($3);} | IF '(' Exp IfHandling')' Instr { gen_if_label($4); } | IF '(' Exp IfHandling')' Instr ELSE IfEndHandling Instr IfElseEndHandling -| WHILE '(' Exp ')' Instr +| WHILE '(' Exp ')' Instr | '{' SuiteInstr '}' ; IfHandling: { gen_if_start($$ = num_if++); }; -- cgit v1.2.3