fix infix emit

This commit is contained in:
zongor 2026-04-09 23:13:25 +00:00
parent 8e430a9d46
commit 11158ba4f9
2 changed files with 8 additions and 3 deletions

View File

@ -234,7 +234,7 @@ c_emit_const()
void
c_emit_print()
{
printf("printf(\"%%s\", ");
printf("putchar");
}
void
@ -301,4 +301,4 @@ c_emitter()
c_emit_open_paren,
c_emit_close_paren,
};
}
}

View File

@ -220,9 +220,14 @@ declaration()
}
static void print_statement() {
if (emitter.notation == INFIX) {
emitter.emit_print();
}
expression();
consume(TOKEN_SEMICOLON);
emitter.emit_print();
if (emitter.notation == POSTFIX) {
emitter.emit_print();
}
}
static void