Compare commits

..

No commits in common. "34481c8ea8963dee3e3615ecff1eab8fb6856796" and "f84eb1649047f3daefd45831c61381a606fc930d" have entirely different histories.

6 changed files with 6 additions and 21 deletions

1
.gitignore vendored
View File

@ -2,4 +2,3 @@ zig-cache/
*.bc
*.ll
*.o
*.out

View File

@ -29,6 +29,8 @@ fn add(a: i32, b: i32) i32 {
return a + b;
}
fn main() i32 {
return 1;
}
// type is void by default
//fn main() {
// print("piss\n");
// // print("2 + 2 = %d\n", add(1, 2));
//}

BIN
hello Executable file

Binary file not shown.

View File

@ -1,3 +0,0 @@
int main(void) {
__rayoko_main();
}

View File

@ -59,13 +59,6 @@ pub fn run(allocator: *std.mem.Allocator, slice: []const u8) !Result {
var cgen = codegen.Codegen.init(allocator, &ctx);
try cgen.gen(root);
var child = try std.ChildProcess.init(
[_][]const u8{ "gcc", "src/entry.c", "outpath.o", "-o", "a.out" },
allocator,
);
try child.spawn();
_ = try child.wait();
return Result.Ok;
}

View File

@ -464,13 +464,7 @@ pub const Parser = struct {
method = try self.parsePreMethod();
}
const orig_name = try self.consumeSingle(.Identifier);
const name = if (std.mem.eql(u8, orig_name.lexeme, "main")) blk: {
break :blk try self.mkToken(.Identifier, "__rayoko_main", orig_name.line);
} else blk: {
break :blk orig_name;
};
const name = try self.consumeSingle(.Identifier);
self.setErrContext("function {}", name.lexeme);