Skip to content

Commit

Permalink
Minor bug fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
vyPal committed Dec 30, 2023
1 parent 3058b8e commit fce9c87
Show file tree
Hide file tree
Showing 9 changed files with 142 additions and 354 deletions.
299 changes: 0 additions & 299 deletions ast_dump.json

This file was deleted.

14 changes: 14 additions & 0 deletions example/src/lib/std.cffc
Original file line number Diff line number Diff line change
@@ -1,7 +1,21 @@
package std;

extern func printf(fmt: *i8): i32;
extern func malloc(size: i64): *i8;
extern func scanf(format: *i8): i32;

export func print(format: *i8) {
printf(format);
}

export func println(format: *i8) {
printf(format);
printf("\n");
}

export func input(prompt: *i8): *i8 {
var buffer: *i8 = malloc(256);
printf(prompt);
scanf("%255s", buffer);
return buffer;
}
11 changes: 9 additions & 2 deletions example/src/main.cffc
Original file line number Diff line number Diff line change
@@ -1,8 +1,15 @@
package main;

extern func printf(ft: *i8): void;
import "lib/std.cffc";

extern func malloc(size: i64): *i8;

func main(): i64 {
printf("Hello, world!\n");
var inp: *i8 = input("Enter your name: ");

print("Hello, ");
print(inp);
println("!");

return 0;
}
Loading

0 comments on commit fce9c87

Please sign in to comment.