aboutsummaryrefslogtreecommitdiff
path: root/src/generator.c
diff options
context:
space:
mode:
authorAdam NAILI2018-06-06 01:49:21 +0200
committerAdam NAILI2018-06-06 01:49:21 +0200
commit8902053fa7cc5cf6b3ef64a805844455971b99d6 (patch)
tree7130f8cb0af97ea81b79d3006447bef7b8759bf6 /src/generator.c
parent68bc689e3e47ed57eb43a531c793d08d9231af4e (diff)
downloadtpc-compiler-8902053fa7cc5cf6b3ef64a805844455971b99d6.tar.gz
Fixing \n in errors, updating commands in report
Diffstat (limited to 'src/generator.c')
-rw-r--r--src/generator.c10
1 files changed, 3 insertions, 7 deletions
diff --git a/src/generator.c b/src/generator.c
index 5c51d3b..1dfe8f3 100644
--- a/src/generator.c
+++ b/src/generator.c
@@ -121,7 +121,7 @@ void gen_function_end_declaration(const char name[], int return_type,
121 121
122void gen_function_return(Type expect, Type actual) { 122void gen_function_return(Type expect, Type actual) {
123 if (actual != expect) { 123 if (actual != expect) {
124 fprintf(stderr, "Return type mismatch at line %d.", lineno); 124 fprintf(stderr, "Return type mismatch at line %d.\n", lineno);
125 exit(1); 125 exit(1);
126 } 126 }
127 if (actual != VOID_T) 127 if (actual != VOID_T)
@@ -487,15 +487,11 @@ int gen_value_tab(const char ident[], Scope scope) {
487 } 487 }
488} 488}
489int gen_num(int value, Scope scope) { 489int gen_num(int value, Scope scope) {
490 if (scope == LOCAL) 490 fprintf(output, "push %d\n", value);
491 fprintf(output, "push %d\n", value); // TODO: remove if?
492 // stored for the semantic analysis.
493
494 return INT; 491 return INT;
495} 492}
496 493
497int gen_char(int value, Scope scope) { 494int gen_char(int value, Scope scope) {
498 if (scope == LOCAL) 495 fprintf(output, "push %d\n", value);
499 fprintf(output, "push %d\n", value); // TODO: remove if?
500 return CHAR; 496 return CHAR;
501} 497}