rename print() to putln()

This commit is contained in:
r4 2021-12-26 10:55:31 +01:00
parent cf93109f1e
commit d8b470f0eb
3 changed files with 4 additions and 4 deletions

View File

@ -7,6 +7,6 @@ while i {
z := x + y z := x + y
y = x y = x
x = z x = z
print(z) putln(z)
i = i - 1 i = i - 1
} }

View File

@ -14,4 +14,4 @@ while k < iterations {
} }
put("π ≈ ") put("π ≈ ")
print(sum) putln(sum)

4
main.c
View File

@ -38,7 +38,7 @@ static Value fn_put(Value *args) {
return (Value){0}; return (Value){0};
} }
static Value fn_print(Value *args) { static Value fn_putln(Value *args) {
fn_put(args); fn_put(args);
printf("\n"); printf("\n");
return (Value){0}; return (Value){0};
@ -152,7 +152,7 @@ int main(int argc, const char **argv) {
/* parse tokens into IR code */ /* parse tokens into IR code */
BuiltinFunc funcs[] = { BuiltinFunc funcs[] = {
{ .name = "put", .side_effects = true, .n_args = 1, .func = fn_put, }, { .name = "put", .side_effects = true, .n_args = 1, .func = fn_put, },
{ .name = "print", .side_effects = true, .n_args = 1, .func = fn_print, }, { .name = "putln", .side_effects = true, .n_args = 1, .func = fn_putln, },
{ .name = "int", .side_effects = false, .n_args = 1, .func = fn_int, }, { .name = "int", .side_effects = false, .n_args = 1, .func = fn_int, },
{ .name = "float", .side_effects = false, .n_args = 1, .func = fn_float, }, { .name = "float", .side_effects = false, .n_args = 1, .func = fn_float, },
{ .name = "pow", .side_effects = false, .n_args = 2, .func = fn_pow, }, { .name = "pow", .side_effects = false, .n_args = 2, .func = fn_pow, },