diff --git a/.gitignore b/.gitignore index 86de850..7f3834b 100644 --- a/.gitignore +++ b/.gitignore @@ -2,4 +2,3 @@ zig-cache/ *.bc *.ll *.o -*.out diff --git a/examples/hello.ry b/examples/hello.ry index 961e4aa..3b05145 100644 --- a/examples/hello.ry +++ b/examples/hello.ry @@ -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)); +//} diff --git a/hello b/hello new file mode 100755 index 0000000..a4b5094 Binary files /dev/null and b/hello differ diff --git a/src/entry.c b/src/entry.c deleted file mode 100644 index b2119d0..0000000 --- a/src/entry.c +++ /dev/null @@ -1,3 +0,0 @@ -int main(void) { - __rayoko_main(); -} diff --git a/src/main.zig b/src/main.zig index a249060..2becea9 100644 --- a/src/main.zig +++ b/src/main.zig @@ -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; } diff --git a/src/parsers.zig b/src/parsers.zig index 7fa359b..81c83cb 100644 --- a/src/parsers.zig +++ b/src/parsers.zig @@ -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);